Thread View: gnu.gcc.bug
1 messages
1 total messages
Started by Ori Dvir
Mon, 25 Nov 1996 00:00
casting as lvalue, inconsistency
Author: Ori Dvir
Date: Mon, 25 Nov 1996 00:00
Date: Mon, 25 Nov 1996 00:00
30 lines
1099 bytes
1099 bytes
Hi,
I have a problem: inconsistent treetment of cast expressions.
Here is the program p1.c:
int * int_ptr;
short * short_ptr;
char * char_ptr;
f1()
{
((char *)(int_ptr)) += 4;
((char *)(short_ptr)) += 4;
((char *)(char_ptr)) += 4;
}
gcc -pedantic p1.c
p1.c: In function `f1':
p1.c:7: warning: ANSI C forbids use of cast expressions as lvalues
p1.c:8: warning: ANSI C forbids use of cast expressions as lvalues
p1.c:9: invalid lvalue in assigmnet
In the first two cases a warning is issued, and the last case causes an error.
I'm using gcc 2.7.2.
What do you think?
Ori dvir : orid@taux01.nsc.com
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads