[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Devel] Off topic? Signed versus unsigned for hexadecimal
From: |
Tom Kacvinsky |
Subject: |
Re: [Devel] Off topic? Signed versus unsigned for hexadecimal |
Date: |
Sat, 21 Apr 2001 20:30:52 -0400 (EDT) |
Hi Antoine,
> Now (assuming 32-bit ints) if 0xFFFFFFFF is signed (being int or long, BTW), I
> would call it a bug.
Well, it likes Compaq's Tru64 UNIX compiler has a bug. Sun's Forte C compiler
and gcc (each in ANSI mode, gcc with -Wall) complain about this code. Compaq's
compiler (in ANSI mode: -std1) does not:
#include <stdio.h>
int main () {
int i = 0xFFFFFFFF; /* Here is where the complier squawks. */
long j = i;
printf ("i = %d, j = %ld, %d\n", i, j, sizeof (int) );
return (0);
}
Thanks for pointing this out.
Tom
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Devel] Off topic? Signed versus unsigned for hexadecimal,
Tom Kacvinsky <=