Topic: classname::classname a type ?


Author: gdr@integrable-solutions.net (Gabriel Dos Reis)
Date: Tue, 23 Sep 2003 22:46:04 +0000 (UTC)
Raw View
kanze@gabi-soft.fr writes:

| gdr@integrable-solutions.net (Gabriel Dos Reis) wrote in message
| news:<m3isnywul9.fsf@uniton.integrable-solutions.net>...
| > Follow.Me@gmx.net ("Oliver S.") writes:
|
| > |  There are compilers that allow sizeof(classname::classname) as a
| > | synonym to sizeof(classname); has anyone found something about this
| > | in the ISO-std ? I doubt that this is legal.
|
| > classname::classname denotes a constructor,
|
| That's not what the standard says.

Please do read the other message of mine in this thread.

--
                                                       Gabriel Dos Reis
                                           gdr@integrable-solutions.net

---
[ 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: wolof@freemail.hu ("WW")
Date: Wed, 24 Sep 2003 05:24:18 +0000 (UTC)
Raw View
Gabriel Dos Reis wrote:
> wolof@freemail.hu ("White Wolf") writes:
>
>> Gabriel Dos Reis wrote:
>>> Follow.Me@gmx.net ("Oliver S.") writes:
>>>
>>>>  There are compilers that allow sizeof(classname::classname) as a
>>>> synonym to sizeof(classname); has anyone found something about this
>>>> in the ISO-std ? I doubt that this is legal.
>>>
>>> classname::classname denotes a constructor
>>
>> Nope.  In 12.1 Paragraph 1 Simon says:
>>
>> "Constructors do not have names."
>>
>> If they do not have names, there is no name "classname::classname",
>> since that would be a constructor name and constructors have no
>> names.
>
> Did you read 5.1/7
>
>    [...] Where class-name :: class-name is used, and the two
>    class-names refer to the same class, this notation names the
>    constructor (12.1).
=============>>>  ^^^^

And where it immediately refers back to 12.1 which starts saying
"Constructors do not have names." and continues by explaining that
"class-name :: class-name" is *only* used to refer (not to name, that is a
bad wording!) to constructors in an out-of-class-body definition.  (No, not
the one with the long tunnel with the light at the end. ;-) )

I think that the *only* problem here is the expression "names the
constructor", which *might* make people think it is a *name*.  The paragraph
correctly refers to 12.1, where all the rules about using the
classname::sameclassname construct are described.  I would not say the above
is a defect, but rather that it is misunderstandable.  First of all
classname::sameclassname does not name, but refers to, and not *the* but *a*
constructor.  IMO it should say:

class-names refer to the same class, this notation *refers to a* constructor
(12.1).

This is clouded enough that people *will* go to 12.1 to figure out what the
heck does that mean - and it cannot be misunderstood as "it is a name".


--
WW aka Attila


---
[ 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: gdr@integrable-solutions.net (Gabriel Dos Reis)
Date: Wed, 24 Sep 2003 15:24:55 +0000 (UTC)
Raw View
wolof@freemail.hu ("WW") writes:

| Gabriel Dos Reis wrote:
| > wolof@freemail.hu ("White Wolf") writes:
| >
| >> Gabriel Dos Reis wrote:
| >>> Follow.Me@gmx.net ("Oliver S.") writes:
| >>>
| >>>>  There are compilers that allow sizeof(classname::classname) as a
| >>>> synonym to sizeof(classname); has anyone found something about this
| >>>> in the ISO-std ? I doubt that this is legal.
| >>>
| >>> classname::classname denotes a constructor
| >>
| >> Nope.  In 12.1 Paragraph 1 Simon says:
| >>
| >> "Constructors do not have names."
| >>
| >> If they do not have names, there is no name "classname::classname",
| >> since that would be a constructor name and constructors have no
| >> names.
| >
| > Did you read 5.1/7
| >
| >    [...] Where class-name :: class-name is used, and the two
| >    class-names refer to the same class, this notation names the
| >    constructor (12.1).
| =============>>>  ^^^^
|
| And where it immediately refers back to 12.1 which starts saying
| "Constructors do not have names."

The rest of the message you're replying to says:

   and

      http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/cwg_defects.html#147

| and continues by explaining that
| "class-name :: class-name" is *only* used to refer (not to name, that is a
| bad wording!) to constructors in an out-of-class-body definition.  (No, not
| the one with the long tunnel with the light at the end. ;-) )

The claim you you said "nope" to is:

   # classname::classname denotes a constructor

I have been careful in chosing the word "denotes", but apparantly you
missed it.

| I think that the *only* problem here is the expression "names the
| constructor", which *might* make people think it is a *name*.  The paragraph
| correctly refers to 12.1, where all the rules about using the
| classname::sameclassname construct are described.  I would not say the above
| is a defect, but rather that it is misunderstandable.  First of all

Which, partly, is why Core Issue #147 exists.

--
                                                       Gabriel Dos Reis
                                           gdr@integrable-solutions.net

---
[ 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: kanze@gabi-soft.fr
Date: Fri, 26 Sep 2003 17:26:53 +0000 (UTC)
Raw View
gdr@integrable-solutions.net (Gabriel Dos Reis) wrote in message
news:<m3isnj8gtc.fsf@uniton.integrable-solutions.net>...
> kanze@gabi-soft.fr writes:

> | gdr@integrable-solutions.net (Gabriel Dos Reis) wrote in message
> | news:<m3isnywul9.fsf@uniton.integrable-solutions.net>...
> | > Follow.Me@gmx.net ("Oliver S.") writes:

> | > |  There are compilers that allow sizeof(classname::classname) as
> | > | a synonym to sizeof(classname); has anyone found something about
> | > | this in the ISO-std ? I doubt that this is legal.

> | > classname::classname denotes a constructor,

> | That's not what the standard says.

> Please do read the other message of mine in this thread.

Well, there's obviously a problem, since the text you quote seems to
directly contradict the text I and White Wolf quoted:-).

I checked out the TC you mentionned.  It still doesn't seem to remove
the problem, since it leaves the text I quoted ("Constructors do not
have names") unchanged, while continuing to speak of naming the
constructor.

I've been living outside of English speaking areas for too long to be
sure, but I'm not sure that naming something necessarily means that it
has a name.  If that is the intent, however, I would suggest replacing
the verb "to name" with "to designate".  It would be clearer to non
native speakers at least, an probably to a number of native speakers --
verbized nouns generally do imply the existance of what the noun
designates.

--
James Kanze           GABI Software        mailto:kanze@gabi-soft.fr
Conseils en informatique orient   e objet/     http://www.gabi-soft.fr
                    Beratung in objektorientierter Datenverarbeitung
11 rue de Rambouillet, 78460 Chevreuse, France, +33 (0)1 30 23 45 16

---
[ 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: gdr@integrable-solutions.net (Gabriel Dos Reis)
Date: Mon, 29 Sep 2003 17:00:45 +0000 (UTC)
Raw View
kanze@gabi-soft.fr writes:

| gdr@integrable-solutions.net (Gabriel Dos Reis) wrote in message
| news:<m3isnj8gtc.fsf@uniton.integrable-solutions.net>...
| > kanze@gabi-soft.fr writes:
|
| > | gdr@integrable-solutions.net (Gabriel Dos Reis) wrote in message
| > | news:<m3isnywul9.fsf@uniton.integrable-solutions.net>...
| > | > Follow.Me@gmx.net ("Oliver S.") writes:
|
| > | > |  There are compilers that allow sizeof(classname::classname) as
| > | > | a synonym to sizeof(classname); has anyone found something about
| > | > | this in the ISO-std ? I doubt that this is legal.
|
| > | > classname::classname denotes a constructor,
                             ^^^^^^^
| > | That's not what the standard says.
|
| > Please do read the other message of mine in this thread.
|
| Well, there's obviously a problem, since the text you quote seems to
| directly contradict the text I and White Wolf quoted:-).

and both of you missed the fine points :-)  Probably because you did
not notice I use "denotes", and  you read too much in the words of the
quoted paragraph.

Not just because something does not have a name means no expression
can denote it.

| I checked out the TC you mentionned.  It still doesn't seem to remove
| the problem, since it leaves the text I quoted ("Constructors do not
| have names") unchanged, while continuing to speak of naming the
| constructor.

The question was whether classname::classname denotes a constructor.
The answer is yes.  In both the original standard and the new
standard.  The new standard contains wording to make that even clearer.

| I've been living outside of English speaking areas for too long to be
| sure, but I'm not sure that naming something necessarily means that it
| has a name.  If that is the intent, however, I would suggest replacing
| the verb "to name" with "to designate".

I was careful in chosing "denotes".  Apparentlty, you missed that.

| It would be clearer to non
| native speakers at least, an probably to a number of native speakers --
| verbized nouns generally do imply the existance of what the noun
| designates.

How is that better?

"To designate" seems to be used in the same sense as "to name".  At
least, the C standard is a concrete example of such usage, and given
the proximity of both languages, it is NOT clear it would be an
improvement to continue the already confusing practice using the same
words to mean subtily different things.

--
                                                       Gabriel Dos Reis
                                           gdr@integrable-solutions.net

---
[ 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: do-not-spam-benh@bwsint.com (Ben Hutchings)
Date: Fri, 12 Sep 2003 15:58:08 +0000 (UTC)
Raw View
In article <Xns93F3DA3F6F1E4FollowMeGmxNet@130.133.1.4>,
"Oliver S." wrote:
>  There are compilers that allow sizeof(classname::classname) as a
> synonym to sizeof(classname); has anyone found something about this
> in the ISO-std ? I doubt that this is legal.

The 2003 revision of the standard explicitly states that this is
illegal (in 3.4.3.1/1a).

---
[ 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: gdr@integrable-solutions.net (Gabriel Dos Reis)
Date: Fri, 12 Sep 2003 23:01:33 +0000 (UTC)
Raw View
Follow.Me@gmx.net ("Oliver S.") writes:

|  There are compilers that allow sizeof(classname::classname) as a
| synonym to sizeof(classname); has anyone found something about this
| in the ISO-std ? I doubt that this is legal.

classname::classname denotes a constructor, hence taking its sizeof is invalid.

GCC, for one, fails to properly implement that.

--
Gabriel Dos Reis, gdr@integrable-solutions.net

---
[ 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: wolof@freemail.hu ("White Wolf")
Date: Mon, 15 Sep 2003 17:09:37 +0000 (UTC)
Raw View
Gabriel Dos Reis wrote:
> Follow.Me@gmx.net ("Oliver S.") writes:
>
>>  There are compilers that allow sizeof(classname::classname) as a
>> synonym to sizeof(classname); has anyone found something about this
>> in the ISO-std ? I doubt that this is legal.
>
> classname::classname denotes a constructor

Nope.  In 12.1 Paragraph 1 Simon says:

"Constructors do not have names."

If they do not have names, there is no name "classname::classname", since
that would be a constructor name and constructors have no names.

--
WW aka Attila


---
[ 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: kanze@gabi-soft.fr
Date: Mon, 15 Sep 2003 21:58:30 +0000 (UTC)
Raw View
gdr@integrable-solutions.net (Gabriel Dos Reis) wrote in message
news:<m3isnywul9.fsf@uniton.integrable-solutions.net>...
> Follow.Me@gmx.net ("Oliver S.") writes:

> |  There are compilers that allow sizeof(classname::classname) as a
> | synonym to sizeof(classname); has anyone found something about this
> | in the ISO-std ? I doubt that this is legal.

> classname::classname denotes a constructor,

That's not what the standard says.  The standard really doesn't say how
you can denote a constructor -- in general, I don't think you can.
   12.1 speaks of "a special declarator syntax" for a constructor ;
elsewhere, constructors will be called implicitly in various cast
constructions, but I don't think you can simply name it in an arbitrary
expression.

> hence taking its sizeof is invalid.

Taking the sizeof a constructor would certainly be invalid.  But there
is no syntax to do so.

In something like "sizeof( classname::classname )", it's not really too
sure what is going on (but constructors are not involved): my intuitive
interpretation would be to look for something called classname in the
class classname.  The name of the class is injected into a class
definition, but I'm not sure that this applies for everything, in all
cases.  Otherwise, since name injection does make any other definition
of classname within the class illegal, the expression is illegal.

--
James Kanze           GABI Software        mailto:kanze@gabi-soft.fr
Conseils en informatique orient   e objet/     http://www.gabi-soft.fr
                    Beratung in objektorientierter Datenverarbeitung
11 rue de Rambouillet, 78460 Chevreuse, France, +33 (0)1 30 23 45 16

---
[ 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: gdr@integrable-solutions.net (Gabriel Dos Reis)
Date: Mon, 15 Sep 2003 21:58:37 +0000 (UTC)
Raw View
wolof@freemail.hu ("White Wolf") writes:

| Gabriel Dos Reis wrote:
| > Follow.Me@gmx.net ("Oliver S.") writes:
| >
| >>  There are compilers that allow sizeof(classname::classname) as a
| >> synonym to sizeof(classname); has anyone found something about this
| >> in the ISO-std ? I doubt that this is legal.
| >
| > classname::classname denotes a constructor
|
| Nope.  In 12.1 Paragraph 1 Simon says:
|
| "Constructors do not have names."
|
| If they do not have names, there is no name "classname::classname", since
| that would be a constructor name and constructors have no names.

Did you read 5.1/7

   [...] Where class-name :: class-name is used, and the two
   class-names refer to the same class, this notation names the
   constructor (12.1).

and

   http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/cwg_defects.html#147

?

--
                       Gabriel Dos Reis <gdr@integrable-solutions.net>

---
[ 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                       ]