CBFalconer said:Neither are they obliged to compile it.
>Prasad wrote:>>I am quite familiar with C and have coded a lot. But I get stumpedThat's an illegal statement.
on precedence rules, and I use paranthesis always. Can one of you
out there explain how the value of s is evaluated in the following
code snippet?
int a=5,s=0;
s=(++a) + (a++) + (--a) + (a--);
No, it isn't. Its behaviour is undefined, but it's not against the law.
Compilers aren't even obliged to diagnose it.
Running software that can translate and execute a C program,
is what an implementation of C is.
Whether or not running software
can translate and execute a text file
containing the line identified by CBFalconer as "illegal",
has no bearing on whether or not
that running software is a C implementation.
Code that contains that line, isn't a C program,
it's just gibberish that looks like a C program;
and if your compiler does compile it,
then you have fooled your compiler.
Followup-To:comp.lang.c
--
pete