Mail Archives: djgpp/1998/08/24/13:59:07
Finally I had catched a strange bug porting a program to DJGPP. It
relies with enum vars. The next example program isolates the problem:
#include <conio.h>
typedef enum { V1, V2, V3 } Tipo;
int main()
{
Tipo i;
i = -1;
if( i < 0 )
puts( "Negative number" );
else
puts( "Positive number" );
}
This program writes with:
DJGPP 2.01 (GCC 2.8.1) : Positive number.
Debian-Linux 1.3 (GCC 2.7.2.1): Positive number.
BC++ 3.0 : Negative number.
HP-UX C (10.10) : Negative number.
HP C/1000 (6.2) : Negative number.
I think it's a GCC bug because the K&R book (second ed.) say enum types
default to int (not unsigned as DJGPP does). I know I must report that
to the GCC maintainer, but I want to know yours opinions first.
Regards, M.Alvarez
- Raw text -