Re: what is the output of this program?
- From: Richard Heathfield <rjh@xxxxxxxxxxxxxxx>
- Date: Fri, 30 May 2008 02:20:17 +0000
Three Headed Monkey said:
<snip>
You are ignoring third warning.
The third warning, as originally reported, was a single apostrophe, and
that's fairly easy to ignore.
If I add prototype for main like below,
compiler only issues one warning
#include <stdio.h>
void main(int argc, char **argv)
{
int C = 0;
printf("C %s C++\n", C == C++ ? "==" : "!=");
}
$ make foo9.exe
lc -ansic -pedantic -A -shadows -unused -O -c foo9.c -o foo9.obj
Warning foo9.c: 3 '
I note that the single apostrophe remains even here. I'm not sure what "lc"
means by this apostrophe, but it's a legal diagnostic message. Perhaps it
means "this code is so screwed I just give up on the whole thing", which
would at least make sense.
Error foo9.c: 3 compiler error in d:\lcc\mc71\types.c--assertion failure
at line 868 Error c:\tmp\clc\foo9.c 3 Compiler error (trap). Stopping
compilation 1 error
make: *** [foo9.obj] Error 1
Perhaps there is bug.
Perhaps there is, but you haven't shown this. The cited program exhibits
undefined behaviour, so the implementation is allowed to do anything it
likes with it - and since I don't see any syntax errors or constraint
violations, I see no requirement for any message whatsoever. For the
compiler to have a bug that is relevant to the above code, it would surely
have to be exhibiting (or harbouring) some inappropriate behaviour when
given that code. But since the Standard allows all behaviours for such
code, it is hard to see how it could be used to demonstrate a bug in the
implementation.
--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
.
- Follow-Ups:
- Re: what is the output of this program?
- From: teapot
- Re: what is the output of this program?
- From: Keith Thompson
- Re: what is the output of this program?
- References:
- what is the output of this program?
- From: Kenny O'Clock
- Re: what is the output of this program?
- From: Pietro Cerutti
- Re: what is the output of this program?
- From: Walter Roberson
- Re: what is the output of this program?
- From: Richard Heathfield
- Re: what is the output of this program?
- From: Joachim Schmitz
- Re: what is the output of this program?
- From: Richard Heathfield
- Re: what is the output of this program?
- From: Joachim Schmitz
- Re: what is the output of this program?
- From: Richard Heathfield
- Re: what is the output of this program?
- From: Three Headed Monkey
- what is the output of this program?
- Prev by Date: Re: Books for learning how to write "big" programs
- Next by Date: Four or Two Bytes?
- Previous by thread: Re: what is the output of this program?
- Next by thread: Re: what is the output of this program?
- Index(es):
Relevant Pages
|