🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

5 total messages Started by Haim Kreitman Sun, 17 Sep 1995 03:44
typedef X;
#1981
Author: Haim Kreitman
Date: Sun, 17 Sep 1995 03:44
21 lines
1047 bytes
STL uses in many places typedef with only one identificator.
I couldn't find such kind of sintax in draft.

typedef type1 type2;   // like in C
typedef type1;         // what does it mean ???


-- Haim Kreitman,
-- haim_kreitman@mail.stil.scitex.com,
-- Scitex Corp.  Israel.


[Moderator's note: the STL documentation has some "code" that isn't
code.  This sort of line isn't supposed to be legal C++, it's just 
supposed to indicate that type1 is a typedef for something.  mha]

---
[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Re: typedef X;
#1986
Author: Etay Bogner
Date: Sun, 17 Sep 1995 17:05
26 lines
1356 bytes
In article <MATT.95Sep16194450@Austern>, Haim Kreitman
<haim_kreitman@mail.stil.scitex.com> wrote:

>> typedef type1;         // what does it mean ???

>> [Moderator's note: the STL documentation has some "code" that isn't
>> code.  This sort of line isn't supposed to be legal C++, it's just 
>> supposed to indicate that type1 is a typedef for something.  mha]

Haim and me once thought that this is a forward declaration for a type.
While reading the draft, I've noticed that there is a new keyword,
"typename", that is used for that purpose.

I think that STL should be updated to contain the "typename" keyword to
prevent confusion.

Etay.

-- Etay Bogner,
-- Etay_Bogner@mail.stil.scitex.com,
-- Scitex Corp.
-- Israel.
---
[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Re: typedef X;
#2001
Author: Craig P. Forbes
Date: Wed, 20 Sep 1995 20:53
48 lines
2184 bytes
In article <Etay_Bogner-1709951504510001@metay_pc.stil.scitex.com>, Etay_Bogner@mail.stil.scitex.com (Etay Bogner) writes:
|> In article <MATT.95Sep16194450@Austern>, Haim Kreitman
|> <haim_kreitman@mail.stil.scitex.com> wrote:
|> 
|> >> typedef type1;         // what does it mean ???
|> 
|> >> [Moderator's note: the STL documentation has some "code" that isn't
|> >> code.  This sort of line isn't supposed to be legal C++, it's just 
|> >> supposed to indicate that type1 is a typedef for something.  mha]
|> 
|> Haim and me once thought that this is a forward declaration for a type.
|> While reading the draft, I've noticed that there is a new keyword,
|> "typename", that is used for that purpose.
|> 
|> I think that STL should be updated to contain the "typename" keyword to
|> prevent confusion.

My understanding is that the typename keyword may only be used in templates
to identify subtypes of the template parameters, which otherwise can not be
identified as a type.

for example:

template <T>
class foo {

  typename T::i;
  int var;

  void fn() {
    T::i *var;  //without the typename keyword this could either be a declaration
                //or an expression.
  }
};

The typename keyword has been added since the September 1994 draft but I'm not
sure exactly when.

-- 
Craig P. Forbes                      McCabe & Associates
                                     5501 Twin Knolls Road, Suite 111
craig@mccabe.com                     Columbia, MD 21045

---
[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
typename versus typedef (was Re: typedef X;)
#2016
Author: Alex Martelli
Date: Sat, 23 Sep 1995 20:54
40 lines
1894 bytes
craig@mccabe.com (Craig P. Forbes) writes:
	...
>My understanding is that the typename keyword may only be used in templates
>to identify subtypes of the template parameters, which otherwise can not be
>identified as a type.
	...
>template <T>
>class foo {
	
>  typename T::i;
>  int var;

>  void fn() {
>    T::i *var;  //without the typename keyword this could either be a declaration

<blink>?  What happened to minimalism...?  Couldn't this be just as
well have been coded...:

	typedef T::i dummynameoftype; // no syntax ambiguity here
	...
	dummynameoftype *var; // no ambiguity here either

Was a whole new keyword really introduced just for the purpose of
avoiding the template author the chore of thinking up a dummy type
name in this situation...?  Or am I missing something here...?


Alex
--
DISCLAIMER: these are TOTALLY personal opinions and viewpoints, NOT connected
in any way with my employer, nor any other organization or individual!
Email: martelli@cadlab.it                            Phone: +39 (51) 597313
CAD.LAB s.p.a., v. Ronzani 7/29, Casalecchio, Italia   Fax: +39 (51) 597120


---
[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Re: typedef X;
#2022
Author: Jason Merrill
Date: Sun, 24 Sep 1995 06:04
32 lines
1672 bytes
>>>>> Craig P Forbes <craig@mccabe.com> writes:

> My understanding is that the typename keyword may only be used in templates
> to identify subtypes of the template parameters, which otherwise can not be
> identified as a type.

> for example:

> template <T>
> class foo {

>   typename T::i;

This line is semantically null, as the 'typename' keyword only affects the
immediate use of the scope expression, not subsequent uses.

>   int var;

>   void fn() {
>     T::i *var;  //without the typename keyword this could either be a declaration
>                 //or an expression.

This must be 'typename T::i *var;'.

>   }
> };

Jason

[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads