On (22 Jul 97) Sunir Shah wrote to Jerry Coffin...
JC> Maybe I'm missing something, but I don't see how being
JC> implementation defined makes things much (or really ANY) different
JC> from how they've been all along. If a particular implemenation
JC> wants to accept a different form of main, it's always been able to
JC> do so.
SS> Yes, but not with the /ansi switch on... well, in C, anyway. I need
SS> to read the C++ specs.
I know of exactly ONE C compiler that complains about main returning
void in C under ANY circumstances. Under the same circumnstances, the
same compiler complains about a number of implementation defined things
as well...
JC> Sure. If you're interested in portability, you don't use things
JC> that are implementation defined. Can you explain how `void main()'
JC> being undefined is ANY different from it being implementation
JC> defined? If there's a real difference, I'm missing it...
SS> Implementation defined doesn't flag an major error. In fact, it
SS> doesn't flag anything unless you have megawarnings on.
Undefined doesn't flag a major error, or anything else necessarily. In
fact, they specifically separated "undefined behavior" from an "error"
so signify that undefined behavior won't be (dependably) diagnosed or
flagged in any other way.
The one difference is that with the possibility of other return types
undefined, the implementation can do so without ever giving you any kind
of warning at all. By contrast, with the effect of other return types
being implementation defined, the implementation must define what other
types of returns it'll allow.
SS> If C++ has no mandate for portability, so be it. In that case, I'll
SS> stop complaining. <-- yeah right. :)
There's no difference in portability at all. If you want portable code,
in both cases you use the return type mandated by the standard. In the
case of C, an impmentation may accept other forms of main, but has no
(officially accepted) way of telling you whether it does or not. In the
case of C++, the implementation can document other forms of main that it
accepts in addition to those the standard requires.
This simply gives an implementation a spot to officially document any
other forms of main it accepts, and encourages any implementation that
does accept other forms to document the fact. There is _absolutely_ no
difference in portability either way. Making something implementation
defined instead of undefined places MORE responsibility on the vendor,
NOT less.
Later,
Jerry.
... The Universe is a figment of its own imagination.
--- PPoint 1.90
---------------
* Origin: Point Pointedly Pointless (1:128/166.5)
|