typdef deprecated?

C

Christopher

Some guy on MS forums is claiming that the typedef keyword is
deprecated and is to be replaces with
"myclass mycontainer", whatever that means.

Is he off his rocker or is there some related truth to it somewhere?

I think the former.
 
A

Alf P. Steinbach

* Christopher:
Some guy on MS forums is claiming that the typedef keyword is
deprecated and is to be replaces with
"myclass mycontainer", whatever that means.

Is he off his rocker or is there some related truth to it somewhere?

I think the former.

typedef is not deprecated.

It could be a communication failure.

Cheers & hth.,

- Alf
 
D

DerTopper

Some guy on MS forums is claiming that the typedef keyword is
deprecated and is to be replaces with
"myclass mycontainer", whatever that means.

Is he off his rocker or is there some related truth to it somewhere?

He's probably referring to the old C style declarations like:
typedef struct SomeStruct {} _SomeStruct;
This typedef was necessary because under C the struct declaration did
not introduce a new type. Note that this is no longer necessary in C+
+; your can just say:
struct SomeStruct {};

To say that all typedefs are superfluous is plain wrong: You cannot
define some function pointer related stuff without typedefs, and also
some template parameter related stuff. Since those cases are only less
often used features of the C++ language, his statement is probably
right for 95% of all code.

Regards,
Stuart
 
T

Triple-DES

Some guy on MS forums is claiming that the typedef keyword is
deprecated and is to be replaces with
"myclass mycontainer", whatever that means.

Is he off his rocker or is there some related truth to it somewhere?

I think the former.

He may be referring to the old C practice of writing

typedef struct C {} C;

whereas in C++ one should really just write

struct C {};
 
T

Triple-DES

Yes, but even the older, C practice is not deprecated (but it
isn't considered idiomatic C++).

True. Now that I think about it, it could also have been a reference
to:

struct C {};
typedef int C;

which is invalid C++, but valid C. Of course, that's not deprecated
either.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top