Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!columbia!garfield.columbia.edu!eppstein From: eppstein@garfield.columbia.edu (David Eppstein) Newsgroups: net.lang.c++ Subject: C++ and sizeof Message-ID: <3522@columbia.UUCP> Date: Fri, 17-Oct-86 13:14:07 EDT Article-I.D.: columbia.3522 Posted: Fri Oct 17 13:14:07 1986 Date-Received: Fri, 17-Oct-86 22:57:25 EDT Sender: nobody@columbia.UUCP Organization: Columbia University CS Department Lines: 18 Is there a good reason why CC expands sizeof itself? E.g. in test.c: test..c: struct x { struct x { /* sizeof = 8 */ int a; int _x_a ; float b; float _x_b ; }; } ; int foo(struct x y) int foo (_auto_y )struct x _auto_y ; { { return y.a + sizeof(y); return (_auto_y . _x_a + 8); } } why does the sizeof(y) become 8 and not sizeof(struct x)? Is there some other use CC makes of the size that makes up for the resulting lack of portability? -- David Eppstein, eppstein@cs.columbia.edu, seismo!columbia!cs!eppstein