Article View: comp.sys.atari.st
Article #26513Re: sizeof("string"), Megamax C
From: braner
Date: Sun, 26 Apr 1987 18:16
Date: Sun, 26 Apr 1987 18:16
21 lines
1618 bytes
1618 bytes
[]
The 'trick' was (?): instead of sizeof("string constant") (fails in Megamax)
use sizeof(array name). So in the example at hand:
char prompt[] = "gnuplot>"
#define PROMPT prompt
...
...sizeof(PROMPT)... /* original code unchanged */
A problem with Megamax is that there is no way to _just_ use the preprocessor.
Sometimes you might want to check out what's happening in some tricky macro
expansion, sometimes you might want to use the preprocessor for a purpose
unrelated to C (other languages, even word processing!). (To defend Megamax:
they did it this way to keep the compiler small and fast.) Another problem
is that the preprocessor is not documented in the Megamax docs _nor_ in the
C 'bible' (K&R) (not fully, anyway).
So: is there a PD C preprocessor (text->text) out there, preferably in C
source code form?
- Moshe Braner
Technical Details
Message-ID:
<820@batcomputer.tn.cornell.edu>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!rutgers!mit-eddie!genrad!decvax!decwrl!pyramid!batcomputer!branerReferences:
<8704120143.AA11235@cory.Berkeley.EDU> <2006@ihuxz.ATT.COM> <468@cernvax.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!rutgers!mit-eddie!genrad!decvax!decwrl!pyramid!batcomputer!braner
From: braner@batcomputer.tn.cornell.edu (braner)
Newsgroups: comp.sys.atari.st
Subject: Re: sizeof("string"), Megamax C
Message-ID: <820@batcomputer.tn.cornell.edu>
Date: Sun, 26-Apr-87 14:16:45 EDT
Article-I.D.: batcompu.820
Posted: Sun Apr 26 14:16:45 1987
Date-Received: Mon, 27-Apr-87 00:48:09 EDT
References: <8704120143.AA11235@cory.Berkeley.EDU> <2006@ihuxz.ATT.COM> <468@cernvax.UUCP>
Reply-To: braner@tcgould.tn.cornell.edu.UUCP (braner)
Organization: Cornell Theory Center, Cornell University, Ithaca NY
Lines: 21
Summary: use an array, not a string constant. PD preprocessor?