www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Bug 88] New: Add .isizeof property for compile-time instance size determination

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/bugzilla/show_bug.cgi?id=88

           Summary: Add .isizeof property for compile-time instance size
                    determination
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P3
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: sean f4.ca


As D lacks a lexical specifier for class reference types there is currently no
way to determine the size of a class instance at compile-time.  A simple
solution would be to add a new property, valid for pointer and reference types,
that evaluates to the size of the referenced type.  Thus:

(byte*).isizeof == byte.sizeof == 1
(byte**).isizeof == (byte*).sizeof == 4 (on 32-bit systems)
byte.isizeof == Error: property isizeof is only valid for reference types.

MyClass { int x, y; }
MyClass.isizeof == 8
(MyClass*).isizeof == MyClass.sizeof == 4 (on 32-bit systems)

Multiple levels of indirection can be eliminated using recursive templates, so
there is no reason to collapse multiple levels of indirection and return the
size of the final referenced type.


-- 
Apr 06 2006
parent reply Walter Bright <newshound digitalmars.com> writes:
d-bugmail puremagic.com wrote:
           Severity: enhancement

Please don't add feature requests to the bug list.
Apr 06 2006
next sibling parent Sean Kelly <sean f4.ca> writes:
Walter Bright wrote:
 d-bugmail puremagic.com wrote:
           Severity: enhancement

Please don't add feature requests to the bug list.

I thought you'd suggested adding the "pending peeves" to the bug list. Sorry. Sean
Apr 06 2006
prev sibling parent reply Kyle Furlong <kylefurlong gmail.com> writes:
Walter Bright wrote:
 d-bugmail puremagic.com wrote:
           Severity: enhancement

Please don't add feature requests to the bug list.

What else is the enhancement severity for?
Apr 06 2006
parent reply Sean Kelly <sean f4.ca> writes:
Kyle Furlong wrote:
 Walter Bright wrote:
 d-bugmail puremagic.com wrote:
           Severity: enhancement

Please don't add feature requests to the bug list.

What else is the enhancement severity for?

Eh, I think Walter wants to maintain a fairly high signal/noise ratio on the bug list. That's perfectly reasonable IMO. Though it suggests the need for a forum besides digitalmars.D for proposals and such, as things tend to get lost fairly quickly there. Sean
Apr 06 2006
parent reply Kyle Furlong <kylefurlong gmail.com> writes:
Sean Kelly wrote:
 Kyle Furlong wrote:
 Walter Bright wrote:
 d-bugmail puremagic.com wrote:
           Severity: enhancement

Please don't add feature requests to the bug list.

What else is the enhancement severity for?

Eh, I think Walter wants to maintain a fairly high signal/noise ratio on the bug list. That's perfectly reasonable IMO. Though it suggests the need for a forum besides digitalmars.D for proposals and such, as things tend to get lost fairly quickly there. Sean

How is any "noise" added to the "signal" you want? The point of those filters is that you can ignore then ones you want to.
Apr 06 2006
next sibling parent Sean Kelly <sean f4.ca> writes:
Kyle Furlong wrote:
 
 How is any "noise" added to the "signal" you want? The point of those 
 filters is that you can ignore then ones you want to.

I have no idea. I'll stop guessing now :-) Sean
Apr 06 2006
prev sibling parent Bruno Medeiros <brunodomedeirosATgmail SPAM.com> writes:
Kyle Furlong wrote:
 Sean Kelly wrote:
 Kyle Furlong wrote:
 Walter Bright wrote:
 d-bugmail puremagic.com wrote:
           Severity: enhancement

Please don't add feature requests to the bug list.

What else is the enhancement severity for?

Eh, I think Walter wants to maintain a fairly high signal/noise ratio on the bug list. That's perfectly reasonable IMO. Though it suggests the need for a forum besides digitalmars.D for proposals and such, as things tend to get lost fairly quickly there. Sean

How is any "noise" added to the "signal" you want? The point of those filters is that you can ignore then ones you want to.

Well, I think it is because feature/enhancement requests require some amount of discussion, and a bugzilla is not an adequate place to make such discussions (not just in terms of S/N ratio, but mainly because of the posting system). I agree with this view. -- Bruno Medeiros - CS/E student http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D
Apr 08 2006