Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > is a typedef necessary?

Reply
Thread Tools

is a typedef necessary?

 
 
Juha Nieminen
Guest
Posts: n/a
 
      09-07-2010
Armen Tsirunyan <(E-Mail Removed)> wrote:
>
>> * There was an example in another thread recently of a situation where
>> typedef seems to be mandatory. It's a completely artificial example,
>> of course, but I don't think it's possible to do without the typedef:
>>
>> * * typedef int Integer;
>> * * (0).~Integer();

>
> If I understand correctly (and there's a fa chance I don't ) the
> pseudodestructor or whatever it's called is 'invented' so that generic
> code wouldn't bother that built-in types don't have destructors. If
> that statement was correct, then the typedef is not really NECESSARY,
> because the construct you wrote is somewhat equivalent to an empty
> statement.


It could theoretically become relevant if, for some reason, you used
a preprocessor macro instead of an actual template to do something which
requires explicitly calling the destructor of an object (and the type of
the object is given as one of the macro parameters).

Of course nobody would write code like that, but it's still theoretically
possible.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CRTP-problem: How can the base class typedef a derived class' typedef? oor C++ 0 05-20-2008 12:39 PM
java needs typedef Steve Green Java 11 03-25-2005 09:52 AM
Typedef of a template? Richard van Wegen C++ 3 07-15-2003 07:22 AM
template typedef as return type Robert A. T. Kaldy C++ 1 07-09-2003 06:25 PM
typedef enum qazmlp C++ 2 07-02-2003 11:55 AM



Advertisments