[Issue 10585] New: Structs in unittest / functions shouldn't have frame pointer unless necessary
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jul 9 11:21:21 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10585
Summary: Structs in unittest / functions shouldn't have frame
pointer unless necessary
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: hsteoh at quickfur.ath.cx
--- Comment #0 from hsteoh at quickfur.ath.cx 2013-07-09 11:21:21 PDT ---
CODE:
------snip------
import std.stdio;
void listMembers(T)() {
writefln("Size of %s is %d", T.stringof, T.sizeof);
foreach (field; __traits(allMembers, T)) {
writefln("\t%s", field);
}
}
void main() {
int y=1;
struct S1 {
int x;
}
static struct S2 {
int x;
bool opEquals() { return true; }
}
struct S3 {
int x;
bool opEquals() { return true; }
}
struct S4 {
int x;
bool opEquals() { return y==1; }
}
listMembers!S1();
listMembers!S2();
listMembers!S3();
listMembers!S4();
}
------snip------
OUTPUT:
------snip------
Size of S1 is 4
x
Size of S2 is 4
x
opEquals
Size of S3 is 16
x
opEquals
this
Size of S4 is 16
x
opEquals
this
------snip------
S3 is identical to S2 (except for the 'static' qualifier); DMD should not
insert the frame pointer since it's not needed.
According to TDPL, the frame pointer is only inserted where needed.
--
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