Warning
MicroWizard
MicroWizard_member at pathlink.com
Fri Feb 24 13:38:42 PST 2006
Really nice ;-)))
Should be collected in D.Learn (not only) for beginners.
Tamas Nagy
In article <43FDD956.5020603 at nospam.org>, Georg Wrede says...
>
>Derek Parnell wrote:
>
>> Sorry, but I forgot something nice. Anonymous structs don't seem to be
>> solving any problem that I've come across, but anonymous unions are very
>> nice.
>>
>> struct S
>> {
>> int type;
>> union {
>> int i;
>> long l;
>> short s;
>> real r;
>> float f;
>> Foo foo;
>> }
>> }
>
>Of course you know, and all regulars here know, but the casual reader
>has to be warned here.
>
>NEVER MIX VALUE AND REFERENCE types in a union!
>
>While technically it poses no problem, in real life you'll end up
>shooting yourself in the foot -- faster than it takes to say 'Ouch!'
>
>And if you don't, the later maintainer of your code *will* shoot you.
More information about the Digitalmars-d
mailing list