[Issue 5097] Safer unions with @tagged

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Oct 22 05:56:37 PDT 2010


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


Don <clugdbug at yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug at yahoo.com.au


--- Comment #5 from Don <clugdbug at yahoo.com.au> 2010-10-22 05:55:54 PDT ---
Sorry bearophile, this looks to me like a feature that doesn't make much sense. 

(1) I don't think there are many potential bugs it could catch
It would be foolish to port C code which hasn't been fully debugged. (If it
hasn't been debugged, you should be rewriting it in D anyway). So it's not
going to find bugs in existing code, only in new code.
And unions are nasty beasts, that should be well encapsulated, so there should
be very little code that uses them.

(2)It would hardly ever be usable.
Most uses of unions in C would probably not work with this feature. In just
about every union I've ever written, the alignment and size were crucial.
In just about every case that it wasn't, a variant would have been usable.
So...

(3) Most of the cases where it would be usable and could catch bugs, are
covered with std.variant.Algebraic already.

-- 
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