typecast violation ?

Nandkishor P nand_kishor@hotmail.com
Sun Jan 19 14:24:00 GMT 2003


Hi group,

GCC doesn't seem to honor the C90 standard for type casting

Consider following test case :

--/cygdrive/d/tests-->cat -n lval.c
     1  int main()
     2  {
     3      char c;
     4      (int)c += 4;
     5  }
--/cygdrive/d/tests-->


As per C90 standard - section 6.3.4 - "Cast operators" states that
44 "A Casts does not yield an lvalue."
Shouldn't gcc flash error as "l-value" required for statement #4 ?
I tried   -ansi, -std=c9x explictly but gcc didn't flash the
expected error ?

Did I miss anything ?

Aha .. GCC version info :  here it is !

--/cygdrive/d/tests-->gcc -v
Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/3.2/specs
Configured with: /netrel/src/gcc-3.2-3/configure 
--enable-languages=c,c++,f77,java --enable-libgcj --enable-threads=posi
x --with-system-zlib --enable-nls --without-included-gettext 
--enable-interpreter --disable-sjlj-exceptions --disable-ve
rsion-specific-runtime-libs --enable-shared --build=i686-pc-linux 
--host=i686-pc-cygwin --target=i686-pc-cygwin --enable
-haifa --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib 
--includedir=/nonexistent/include --libexecd
ir=/usr/sbin
Thread model: posix
gcc version 3.2 20020927 (prerelease)

Regards,
Nandkishor



_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail



More information about the Gcc-bugs mailing list