Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!rutgers!seismo!columbia!garfield.columbia.edu!eppstein From: eppstein@garfield.columbia.edu (David Eppstein) Newsgroups: net.lang.c++ Subject: C++ and sizeof Message-ID: <3580@columbia.UUCP> Date: Fri, 24-Oct-86 17:36:32 EDT Article-I.D.: columbia.3580 Posted: Fri Oct 24 17:36:32 1986 Date-Received: Sat, 25-Oct-86 06:43:03 EDT References: <6206@alice.uUCp> Sender: nobody@columbia.UUCP Organization: Columbia University CS Department Lines: 16 Something I guess I didn't make clear in my original posting was that I was more interested in the effect of expanding sizeof on the portability of the C++ translator itself. I.e. it has to know enough about the machine to calculate sizeof in the first place. A compiler I worked on forces individual chars and the starts of char arrays to be word-aligned; this may not be a totally bizarre requirement but it might not have been anticipated, and surely there is worse out there. I didn't find the examples for why sizeof must be expanded particularly convincing; while CC has to calculate the sizes in those cases if is to accept and translate them, I am not sure that it should accept them in the first place. (To recap one was an array bound declared in one place as an explicit constant and in another as a size; the other was using sizes as case labels.) -- David Eppstein, eppstein@cs.columbia.edu, seismo!columbia!cs!eppstein