digitalmars.D.bugs - [Issue 1141] New: <Class>.classinfo.init.length does not give instance size on linux
- d-bugmail puremagic.com (54/54) Apr 13 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1141
- Lionello Lunesu (7/10) Apr 13 2007 .length?
- d-bugmail puremagic.com (9/9) Apr 13 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1141
http://d.puremagic.com/issues/show_bug.cgi?id=1141
Summary: <Class>.classinfo.init.length does not give instance
size on linux
Product: D
Version: 1.012
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla digitalmars.com
ReportedBy: benoit tionex.de
While this seems to work on windows, on linux it doesn't.
module t;
extern (C) int printf( char*, ... );
class A1{
int a;
int b;
int[3] c;
int d;
static void print(){
printf( "%d %d %d %d %d\n",
a.offsetof,
b.offsetof,
c.offsetof,
d.offsetof,
A1.classinfo.init.sizeof);
}
}
class A2{
int a;
int[3] b;
int c;
int d;
static void print(){
printf( "%d %d %d %d %d\n",
a.offsetof,
b.offsetof,
c.offsetof,
d.offsetof,
A2.classinfo.init.sizeof);
}
}
void main(){
A1.print;
A2.print;
}
frank lingurke:~$ dmd t
gcc t.o -o t -m32 -lphobos -lpthread -lm
frank lingurke:~$ ./t
8 12 16 28 8
8 12 24 28 8
--
Apr 13 2007
<d-bugmail puremagic.com> wrote in message news:bug-1141-3 http.d.puremagic.com/issues/...http://d.puremagic.com/issues/show_bug.cgi?id=1141 Summary: <Class>.classinfo.init.length does not give instance.length?A2.classinfo.init.sizeof);or .sizeof? I think that .sizeof is correctly returning the size of an array (which is 8 on x86) L.
Apr 13 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1141
benoit tionex.de changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |INVALID
Like lionello said, this should be .length not .sizeof :/
--
Apr 13 2007









"Lionello Lunesu" <lionello lunesu.remove.com> 