Re: lcc-win32 conformance question
- From: Ben Bacarisse <ben.usenet@xxxxxxxxx>
- Date: Sun, 27 Apr 2008 01:06:47 +0100
Lew Pitcher <lpitcher@xxxxxxxxxxxx> writes:
In comp.lang.c, teapot wrote:
If I compile this program
int main(void)
{
return 0; // foo bar baz
}
with
"lc -A -ansi89 foo.c"
(minus the quotes), no diagnostic is produced; but isn't this style of
comment illegal in C89
As I understand it, there is nothing in the C89 standard that explicitly
indicates that the C++-style // comment is illegal.
The syntax does. // is either a syntax error or the start of something
like 1//* divide? */2 which must be taken as an arithmetic
expression. I can't see what else it could be.
However, a compliant compiler is obliged to interpret the given line
// foo bar baz
as
a division token, followed by
a division token, followed by
an identifier token, followed by
an identifier token, followed by
an identifier token, followed by
a right brace bracket
which, of course, cannot be interpreted as a semantically correct C (C89)
statement. IIRC, a diagnostic should be emitted.
Yes, the cited example is just a syntax error, but we have no idea
what, if any, claims are made about the -ansi89 flag. Maybe it
implements some parts of ANSI 89 C? Unless that author says what is
should do, how can we anyone complain about what the compiler does?
--
Ben.
.
- References:
- lcc-win32 conformance question
- From: teapot
- Re: lcc-win32 conformance question
- From: Lew Pitcher
- lcc-win32 conformance question
- Prev by Date: Re: lcc-win32 conformance question
- Next by Date: Re: lcc-win32 conformance question
- Previous by thread: Re: lcc-win32 conformance question
- Next by thread: Re: lcc-win32 conformance question
- Index(es):
Relevant Pages
|