🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #1910

Re: Another sizeof question

#1910
From: Michael Meissner
Date: Tue, 30 Oct 1990 17:15
28 lines
1914 bytes
In article <492@taumet.com> steve@taumet.com (Stephen Clamage) writes:

| Some C compilers support sizeof in the preprocessor.  The results are
| then kind of weird.  Such preprocessors sometimes recognize the size of
| the built-in types (int, long, etc), but not user types.  Recognizing
| the size of user types is part of the C compilation process, not just
| preprocessing, so a stand-alone preprocessor must either act as a
| complete C parser, or act differently than when it is part of the
| complete compilation.

When I worked at Data General on the MV C compiler, I added sizeof
support to the preprocessor (which is called as a coroutine from
within the lexer).  Because the preprocessor was built into the
compiler, it involved no hand wringing.  In fact, it would have been
more work to disable sizeof, since the same parser was used to parse
#if/#elif expressions as the normal expressions.

This turned out to be useful in non-portable system codes to make sure
a structure was the precise size needed by the external specification.
Many of the internal DG types complained when the GNU and Greenhills
compilers on the 88k did not support this feature....


--
Michael Meissner	email: meissner@osf.org		phone: 617-621-8861
Open Software Foundation, 11 Cambridge Center, Cambridge, MA, 02142

Do apple growers tell their kids money doesn't grow on bushes?
Technical Details
Message-ID: <MEISSNER.90Oct30121525@osf.osf.org>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!watmath!att!att!linac!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!think.com!paperboy!meissner
References: <13171@crdgw1.crd.ge.com> <492@taumet.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!watmath!att!att!linac!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!think.com!paperboy!meissner
From: meissner@osf.org (Michael Meissner)
Newsgroups: comp.std.c
Subject: Re: Another sizeof question
Message-ID: <MEISSNER.90Oct30121525@osf.osf.org>
Date: 30 Oct 90 17:15:25 GMT
References: <13171@crdgw1.crd.ge.com> <492@taumet.com>
Sender: troot@OSF.ORG
Organization: Open Software Foundation
Lines: 28
In-reply-to: steve@taumet.com's message of 28 Oct 90 17:05:51 GMT