March 28, 2007 [Issue 1082] New: The .offsetof property yields a signed int, a size_t would be more appropriate | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=1082 Summary: The .offsetof property yields a signed int, a size_t would be more appropriate Product: D Version: 1.010 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: guido@grumpy-cat.com The .offsetof property yields a signed int value, an unsigned int like size_t would be more appropriate. Also the exact type yielded by .offsetof should be documented in the Portability Guide of the documentation. The types yielded by .length, .sizeof, and .alignof are specified there. /* dmd -w -O test.d ./test size_t type = uint sizeof type = uint alignof type = uint offsetof type = int */ import std.stdio; struct foo { int bar; } void main() { writefln("size_t type = ", typeid(size_t)); writefln("sizeof type = ", typeid(typeof(foo.bar.sizeof))); writefln("alignof type = ", typeid(typeof(foo.bar.alignof))); writefln("offsetof type = ", typeid(typeof(foo.bar.offsetof))); } -- |
April 12, 2007 [Issue 1082] The .offsetof property yields a signed int, a size_t would be more appropriate | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=1082 bugzilla@digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED ------- Comment #1 from bugzilla@digitalmars.com 2007-04-11 22:02 ------- Fixed dmd 1.011 -- |
Copyright © 1999-2021 by the D Language Foundation