Topic: Suggest rewording


Author: "Yaroslav Mironov" <yaro@nevacom.spb.ru>
Date: Sun, 22 Apr 2001 02:16:53 GMT
Raw View
Hi,

3.6.1/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...

I know that from the point of view of native english speakers the last
sentence unambiguously means "the return type is int, everything else about
the type of main is implementation-defined" (I hope I'm not mistaken here
:)).

But to foreigners it is sometimes very hard to distinguish this "otherwise"
from the "otherwise" like in "the return type is int, otherwise I'll eat my
beard" and they spend too much time in flame wars trying to prove that the
standard says "the return type is int, but it can also be
implementation-defined".

Since it is an international standard I suggest rewording this sentence. It
seems to me that something like

"An implementation shall not predefine the main function. This function
shall not be overloaded. It shall have a return type of type int, but the
number and type of (its) parameters are implementation-defined".

would mean the same, but in a much clearer way.

Comments?

Yaroslav

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]





Author: remove.haberg@matematik.su.se (Hans Aberg)
Date: Sun, 22 Apr 2001 11:04:21 GMT
Raw View
In article <003901c0ca95$562b73c0$9e00000a@yaroslav.nevacom.spb.ru>,
"Yaroslav Mironov" <yaro@nevacom.spb.ru> wrote:
>3.6.1/2
>...An implementation shall not predefine the main function. ... It shall
have a >return type of type int, but otherwise its type is
implementation-defined...
>
>I know that from the point of view of native english speakers the last
>sentence unambiguously means
...
>But to foreigners it is sometimes very hard to distinguish this "otherwise"
>from the "otherwise" like in
...
>Since it is an international standard I suggest rewording this sentence.
...
>Comments?

For example:
  It shall have the return type int, but its argument type is
implementation defined.

-- But perhaps they mean that "main" can also be an inline, template, etc. :-)

  Hans Aberg      * Anti-spam: remove "remove." from email address.
                  * Email: Hans Aberg <remove.haberg@member.ams.org>
                  * Home Page: <http://www.matematik.su.se/~haberg/>
                  * AMS member listing: <http://www.ams.org/cml/>

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]





Author: "Homer Meyer" <homer@cqg.com>
Date: Mon, 23 Apr 2001 19:41:29 GMT
Raw View
"Yaroslav Mironov" <yaro@nevacom.spb.ru> wrote in message
news:003901c0ca95$562b73c0$9e00000a@yaroslav.nevacom.spb.ru...
> Hi,
>
> 3.6.1/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...

<SNIP>

> Since it is an international standard I suggest rewording this sentence.
It
> seems to me that something like
>
> "An implementation shall not predefine the main function. This function
> shall not be overloaded. It shall have a return type of type int, but the
> number and type of (its) parameters are implementation-defined".
>
> would mean the same, but in a much clearer way.
>
> Comments?

The suggested rewording doesn't mean the same thing.  There are other things
covered by the type of main that are not included in "the number and type of
(its) parameters".  There are specifiers like 'extern "C"' and
implementation defined specifiers, such as calling conventions.  Your
rewording would make implementations that offered such possibilities for the
type of main non compliant with the standard.  I'm not sure if variations
like this are common (I have not run into any in my work), but it is a point
worth considering.


---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]





Author: Christopher Eltschka <celtschk@dollywood.itp.tuwien.ac.at>
Date: Mon, 23 Apr 2001 20:10:19 GMT
Raw View
Yaroslav Mironov wrote:
>
> Hi,
>
> 3.6.1/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...
>
> I know that from the point of view of native english speakers the last
> sentence unambiguously means "the return type is int, everything else about
> the type of main is implementation-defined" (I hope I'm not mistaken here
> :)).
>
> But to foreigners it is sometimes very hard to distinguish this "otherwise"
> from the "otherwise" like in "the return type is int, otherwise I'll eat my
> beard" and they spend too much time in flame wars trying to prove that the
> standard says "the return type is int, but it can also be
> implementation-defined".
>
> Since it is an international standard I suggest rewording this sentence. It
> seems to me that something like
>
> "An implementation shall not predefine the main function. This function
> shall not be overloaded. It shall have a return type of type int, but the
> number and type of (its) parameters are implementation-defined".
>
> would mean the same, but in a much clearer way.
>
> Comments?

What about just reversing the two sentences, without too much
reformulation?

"An implementation shall not predefine the main function. This function
shall not be overloaded. Its type is implementation defined, except
that it shall have a return type of int."

This has the advantage that it's less likely to change the semanics
in a non-obvious way (f.ex., the original - and my - version explicitly
allows main to be extern "C", because linkage is part of hte type.
OTOH, with your version, I'm not sure if main would still be allowed
to be extern "C" - at least it doesn't give explicit permission).

And I think the formulation with "except" is totally unambiguous.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]