digitalmars.D.bugs - [Issue 632] New: Typedef promotions spec ambiguous - ultimate base type or lowest common denominator?
- d-bugmail puremagic.com Dec 02 2006
- d-bugmail puremagic.com Dec 31 2008
- d-bugmail puremagic.com Dec 31 2008
- d-bugmail puremagic.com Nov 08 2010
http://d.puremagic.com/issues/show_bug.cgi?id=632 Summary: Typedef promotions spec ambiguous - ultimate base type or lowest common denominator? Product: D Version: 0.175 Platform: All URL: http://www.digitalmars.com/d/type.html OS/Version: All Status: NEW Keywords: spec Severity: normal Priority: P2 Component: www.digitalmars.com AssignedTo: bugzilla digitalmars.com ReportedBy: smjg iname.com OtherBugsDependingO 511 nThis: "# If one operand is a typedef and the other is the base type of that typedef, the result is the base type. # If the two operands are different typedefs but of the same base type, then the result is that base type." By "base type", does it mean the built-in type from which the typedef is ultimately derived, or the most-derived type that is a common base to both (the lowest common denominator)? In particular, it's tempting to think that, given typedef int qwert; typedef qwert yuiop; typedef qwert asdfg; that the "base type" in question is qwert, which is the immediate parent type of yuiop and adsfg, and hence that an expression involving any two of these typedefs will promote to qwert. This is similar to the common use of "base class" in OOP lingo. The better way, IMO, is to define such promotions to be to the lowest common denominator type. Consequently, any typedef (other than one of a type that's always subject to integer promotions, but that's another matter) would be closed under arithmetic operations. I imagine that implementing this principle in the compiler wouldn't be difficult. Please see http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D&artnum=44821 for further commentary. But whichever method is chosen, the spec needs to be made clearer. --
Dec 02 2006
http://d.puremagic.com/issues/show_bug.cgi?id=632 smjg iname.com changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Typedef promotions spec |Typedef/enum promotions spec |ambiguous - ultimate base |ambiguous - ultimate base |type or lowest common |type or lowest common |denominator? |denominator? ------- Comment #1 from smjg iname.com 2008-12-31 11:27 ------- Issue 633 has been reduced to this one. Whatever the spec is fixed to say, it must also avoid any ambiguity in what happens when mixed enum/typedef chains are involved. This will only be an issue if the ultimate base type route is chosen - going by lowest common denominator naturally addresses this. --
Dec 31 2008
http://d.puremagic.com/issues/show_bug.cgi?id=632 ------- Comment #2 from smjg iname.com 2008-12-31 11:28 ------- *** Bug 633 has been marked as a duplicate of this bug. *** --
Dec 31 2008
http://d.puremagic.com/issues/show_bug.cgi?id=632 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla digitalmars.com Resolution| |FIXED --- Comment #3 from Walter Bright <bugzilla digitalmars.com> 2010-11-08 14:33:58 PST --- http://www.dsource.org/projects/phobos/changeset/2137 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 08 2010









d-bugmail puremagic.com 