Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Possible typo in C++98

0 views
Skip to first unread message

Ivan A. Kosarev

unread,
Sep 22, 2005, 1:23:45 AM9/22/05
to
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...@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]

Victor Bazarov

unread,
Sep 22, 2005, 2:31:22 PM9/22/05
to
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

Alberto Ganesh Barbati

unread,
Sep 23, 2005, 9:35:09 AM9/23/05
to
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

0 new messages