Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Initialize pointer-to-struct declaration to an unnamed struct?

Reply
Thread Tools

Initialize pointer-to-struct declaration to an unnamed struct?

 
 
Ehud Shapira
Guest
Posts: n/a
 
      06-30-2007
> But that doesn't help choose which element is being initialized.
> union U
> {
> double d1 ;
> double d2 ;
> } u = 3.1415 ;

Both are the same, there's no "which".

> union U
> {
> long l ;
> double d ;
> } u = 42 ;
>
> Which element is being initialized?

Here there's ambiguity, so in this case I agree further qualification
would be needed. But requiring it for simple cases seems redundant.

> int* p = new int ;

Of course this would be dynamic (with perhaps being optimized to a
static when this makes sense). I thought you were talking about cases
like simple, ctor-less, initialized structs.

 
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
Using-declaration or using-directive inside unnamed-namespace? Niels Dekker - no reply address C++ 1 04-27-2010 04:16 PM
if instance variable get initialize after assigning some values or after constructor then when does static variable get initialize Tony Morris Java 3 02-04-2006 08:39 AM
initialize array elements during declaration hyena Java 10 01-24-2005 10:21 PM
forward declaration for typedef of unnamed structs Jordi Vilar C++ 5 02-18-2004 09:41 PM
forward declaration for typedef of unnamed structs Jordi Vilar C Programming 5 02-18-2004 09:41 PM



Advertisments