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

E

Ehud Shapira

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.
 

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