bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

problem on GNU grep 2.5g


From: Marc Rogliano
Subject: problem on GNU grep 2.5g
Date: Tue, 5 Nov 2002 19:02:20 +0100

Hello,
Yesterday I translated partly the GNU GREP source code to BORLAND C++
(compiler BCC5.5) on windows and found a small problem on the following in
file system.h :

#define TYPE_MAXIMUM(t) ((t) (~ (t) 0 - TYPE_MINIMUM (t)))
- doesn't work correctly for int and long integers (4 bytes) : it returns
the value "1" instead of 2147483647
- work well for char (1 byte) or short (2 bytes)

I propose the following code (tested on CYGWIN) :
#define TYPE_MAXIMUM(t) ((t) (TYPE_SIGNED (t) \
                              ? ~ (t) (1 << (sizeof (t) * CHAR_BIT - 1)) \
                              : ~ (t) 0))

Regards,
Marc





reply via email to

[Prev in Thread] Current Thread [Next in Thread]