Thread View: gnu.gcc.bug
2 messages
2 total messages
Started by Doug Schmidt
Wed, 05 Oct 1988 01:06
Legal ansi?
Author: Doug Schmidt
Date: Wed, 05 Oct 1988 01:06
Date: Wed, 05 Oct 1988 01:06
28 lines
1031 bytes
1031 bytes
Hi,
Is the following short code legal Ansi-C? gcc -ansi accepts it,
gcc -pedantic rejects it, and the Sun 4.0 cc compiler also rejects it.
thanks,
Doug
----------------------------------------
typedef int ITEM_TYPE;
typedef struct Tree Tree;
struct Tree {
ITEM_TYPE Item;
char Tag;
Tree *Left;
Tree *Right;
} *Root;
int Test ( P, Item )
Tree *P;
ITEM_TYPE Item;
{
(( P->Item > Item ) ? P->Left : P->Right ) = (Tree *) malloc(sizeof(Tree));
}
----------------------------------------
Re: Legal ansi?
Author: Dave Hanson
Date: Wed, 05 Oct 1988 11:58
Date: Wed, 05 Oct 1988 11:58
12 lines
847 bytes
847 bytes
In article <765@paris.ics.uci.edu> Doug Schmidt <schmidt@crimee.ics.uci.edu> writes:
Hi,
Is the following short code legal Ansi-C? gcc -ansi accepts it,
gcc -pedantic rejects it, and the Sun 4.0 cc compiler also rejects it.
...
{
(( P->Item > Item ) ? P->Left : P->Right ) = (Tree *) malloc(sizeof(Tree));
}
no. conditional expressions are not l-values.
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