Last change
on this file since 2 was 2, checked in by bird, 22 years ago |
Initial revision
|
-
Property cvs2svn:cvs-rev
set to
1.1
-
Property svn:eol-style
set to
native
-
Property svn:executable
set to
*
|
File size:
648 bytes
|
Line | |
---|
1 | #include <stdio.h>
|
---|
2 |
|
---|
3 | class c{
|
---|
4 | public:
|
---|
5 | char * f;
|
---|
6 | };
|
---|
7 |
|
---|
8 | class c2{
|
---|
9 | public:
|
---|
10 | float f2;
|
---|
11 | };
|
---|
12 |
|
---|
13 |
|
---|
14 | static class sss: public c, public c2{
|
---|
15 | public:
|
---|
16 | char * m;
|
---|
17 | } sss;
|
---|
18 |
|
---|
19 | #define _offsetof(st,f) ((char *)&((st *) 16)->f - (char *) 16)
|
---|
20 |
|
---|
21 | int main (void) {
|
---|
22 | printf ("++Class with pointer inhereting classes with pointer & float:\n");
|
---|
23 | printf ("size=%d,align=%d\n", sizeof (sss), __alignof__ (sss));
|
---|
24 | printf ("offset-f=%d,offset-f2=%d,offset-m=%d,\nalign-f=%d,align-f2=%d,align-m=%d\n",
|
---|
25 | _offsetof (class sss, f), _offsetof (class sss, f2), _offsetof (class sss, m),
|
---|
26 | __alignof__ (sss.f), __alignof__ (sss.f2), __alignof__ (sss.m));
|
---|
27 | return 0;
|
---|
28 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.