W
WW
Ron said:And if the compiler does decide to accept ill-formed code, it still
is required to issue a "diagnostic."
That was in Herbs first post. And I did not want to overload his brain.
Ron said:And if the compiler does decide to accept ill-formed code, it still
is required to issue a "diagnostic."
Reply to article by: "Attila Feher said:Date written: Thu, 25 Sep 2003 11:18:42 +0300
MsgID:<[email protected]>
You need to learn to read.
The_Sage said:No you do.
The spec clearly stated that "...its type is
implementation-defined"
and you failed to explain why IBM, MS, and Borland all
implemented-defined void main() and yet still claim to be
ISO compliant.
Or maybe it wasn't that you failed,
but that you dodged and evaded the issue because
it exposes a gap in your claim
bigger than the gap between your ears?
Reply to article by: "WW said:Date written: Fri, 26 Sep 2003 06:08:56 +0300
MsgID:<[email protected]>
The_Sage said:Well?
WW said:That was in Herbs first post. And I did not want to overload his
brain.
The_Sage said:[...]
Well?
morning (though I wouldn't be suprised if you stick with sandals
or velcro straps).
Attila said:David B. Held wrote:
[SNIP]
morning (though I wouldn't be suprised if you stick with sandals
or velcro straps).
Hey! I have velcro straps! And sandals.
You mean, IBM, MS, Borland and other compiler manufacturer's
interpretation of the standard is incorrect.
Here is what the standard actually says:
Subclause 3.6.1, paragraph 2:
An implementation shall not predefine the `main' function.
This function shall not be overloaded. It shall have a return
type of type `int,' but otherwise its type is implementation-
defined. All implementations shall allow both of the following
definitions of `main':
int main() { /* ... */ }
and
int main(int argc, char* argv[]) { /* ... */ }
When the C++ standard uses the word ``shall'' in this way, it
expresses a requirement on programs that every standard-conforming
implementation is required to enforce, at least by producing a
diagnostic message (which might be only a warning) for any program
that does not meet the requirement.
So, for example, if I try to compile the following program:
void main() { }
under g++ version 3.3.1, I get the following message:
prog.c:1: error: `main' must return `int'
That's what the standard says should happen.
The standard does not mention any error messages when using a
different version of main(). What the standard actually implies, and
I quote research at ATT concerning this topic...
"A conforming implementation accepts
int main() { /* ... */ }
int main(int argc, char* argv[]) { /* ... */ }
A conforming implementation may provide more versions of main(),
but they must all have return type int"
(http://www.research.att.com/~bs/bs_faq2.html#void-main)
On most of the major compilers, it is permitted, so the books are correct.
Strictly speaking, it is conforming, it just isn't recommended
because it may not be portable, for example, GCC doesn't implement
any other version of main() other than the one suggested by the ISO
standard.
That proves nothing, as explained above.
No it doesn't.
Yes they are.
Congratulations for being the first person to talk sense in this
whole entire newsgroup.
int? Why do you guys keep trying to ignore reality so you can support your
religion of "pure" C++? Here it is again for those of you who can't read yet...
"3.6.1 Main function paragraph 2:
It shall have a return type of type int
otherwise its type is implementation-defined"
Duh! The int is mandatory but void is optional.
No, it does not. You have been told that by Herb Sutter, who *is* the
representative of Microsoft in this circles.
Andrew said:and who is also the convener of the ISO C++ standards committee.
sliced bread, just that it is a defensible decision on the part of
the committee.
However, the committee decided to leave it alone because
there might already be programs out there relying on it.
Isn't compatibility wonderful?
Reply to article by: "WW said:Date written: Fri, 26 Sep 2003 06:53:15 +0300
MsgID:<[email protected]>
Please look at Chapter 28 and let me know what do you see there about void
main.
Reply to article by: "David B. Held said:Date written: Fri, 26 Sep 2003 00:58:09 -0500
MsgID:<[email protected]>
I have challenged you several times to show statements by any
of these organizations claiming that their compilers are 100%
conforming.
Reply to article by: Andrew Koenig said:Date written: Fri, 26 Sep 2003 14:57:40 GMT
MsgID:<[email protected]>
and who is also the convener of the ISO C++ standards committee.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.