Topic: Possible typo in C++98


Author: v.Abazarov@comAcast.net (Victor Bazarov)
Date: Thu, 22 Sep 2005 18:31:22 GMT
Raw View
Ivan A. Kosarev wrote:
> C++98 13.5.4 #1 says: "...Thus, a call x(arg1,...) is interpreted as
> x.operator()(arg1,...) for a class object x of type T if T::operator()(T1,
> T2, T3) exists and if the operator is selected as the best match
> function...".
>
> Can anybody clear whether something like "...if T::operator()(T1, ...)
> exists..." actually should be there, and thus is it just a kind of typo in
> the Standard? If not, what the T1, T2 and T3 types should mean there?

I think whoever wrote it wanted to avoid the interpretation of the example
declaration (the proposed by you "T::operator()(T1, ...)") *literally*, in
other words, as having the _ellipsis_ in the argument list.  While those
dots in the text "a call x(arg1,...) is interpreted" cannot be part of the
syntax and therefore cannot be misinterpreted, the ellipsis in the other
part can, and therefore would have to be supplied with a note that those
dots do not mean the same thing as "ellipsis" usually means.

I do not think your alternative is an improvement, but I don't have my own
to propose.

V

---
[ 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.jamesd.demon.co.uk/csc/faq.html                       ]





Author: AlbertoBarbati@libero.it (Alberto Ganesh Barbati)
Date: Fri, 23 Sep 2005 13:35:09 GMT
Raw View
Ivan A. Kosarev wrote:
> Hello,
>
> C++98 13.5.4 #1 says: "...Thus, a call x(arg1,...) is interpreted as
> x.operator()(arg1,...) for a class object x of type T if T::operator()(T1,
> T2, T3) exists and if the operator is selected as the best match
> function...".
>
> Can anybody clear whether something like "...if T::operator()(T1, ...)
> exists..." actually should be there, and thus is it just a kind of typo in
> the Standard? If not, what the T1, T2 and T3 types should mean there?
>

I agree that it's very confusing. Moreover, writing "x(arg1,...)" is
also misleading, as it's clearly stated that the expression-list can be
empty. Taking also into account Victor Bazarov's remark about the
ambiguity of ellipsis, I would rewrite the entire sentence like this:

"...Thus, a call x(...) is interpreted as x.operator()(...) for a class
object x of type T if there is a T::operator() with a matching number of
parameters and if such operator is selected as the best match function...".

Ganesh

---
[ 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.jamesd.demon.co.uk/csc/faq.html                       ]





Author: ikosarev@online.ru ("Ivan A. Kosarev")
Date: Thu, 22 Sep 2005 05:23:45 GMT
Raw View
Hello,

C++98 13.5.4 #1 says: "...Thus, a call x(arg1,...) is interpreted as
x.operator()(arg1,...) for a class object x of type T if T::operator()(T1,
T2, T3) exists and if the operator is selected as the best match
function...".

Can anybody clear whether something like "...if T::operator()(T1, ...)
exists..." actually should be there, and thus is it just a kind of typo in
the Standard? If not, what the T1, T2 and T3 types should mean there?

Thank you.

--
Unicals Group -- Development Tools for OEMs
http://www.unicals.com


---
[ 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.jamesd.demon.co.uk/csc/faq.html                       ]