[Issue 7014] Better union initialization syntax

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Nov 26 08:44:51 PST 2011


http://d.puremagic.com/issues/show_bug.cgi?id=7014


timon.gehr at gmx.ch changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |timon.gehr at gmx.ch


--- Comment #1 from timon.gehr at gmx.ch 2011-11-26 08:43:51 PST ---
(In reply to comment #0)
> 
> But I don't like that GNU-C idea, a problem with cast() is that it's not
> precise enough, if there are two fields like this, what is a good way to assign
> 's' or 'u' using a cast()?
> 
> union Foo { int s; uint u; };

cast(Foo)cast(uint)exp
cast(Foo)cast(int)exp

You understand that both are assigned, regardless of which one you choose and
ergo it is never a problem?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list