🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #6996

Re: C compilers code generation

#6996
From: Mike (My Watch Has Windows) Meye...
Date: Wed, 21 Nov 1990 18:29
28 lines
2015 bytes
In article <90324.204949GIAMPAL@auvm.auvm.edu> GIAMPAL@auvm.auvm.edu writes:
   In article <1990Nov19.130657.19380@sisd.kodak.com>, jeh@sisd.kodak.com (Ed
   Hanway) says:
   >I'd never use strlen("constant") either, unless I knew that it was
   >evaluated at compile time. I have used (albeit in a toy program):
   >
   >#define SAY(s)  Write(backstdout, s, strlen(s))
   >
   >which works for both SAY("const") and SAY(var).
   Yes this does work, but if the string is a constant, then you get a
   duplicate copy of the string put in your data segment.  I use :

   #define MSG(s) { char *s; Write(Output(), s, strlen(s)); }

So use the flag on your compiler that forces identical string
constants into the same string. That way, you don't have the
extraneous variables (and manipulations thereof) in your code.

Or take the approach of one programmer I knew - he never coded string
constants, except for the place where he defined a variable to point
to them. But the compiler can do that for you.

	<mike
--
Cats will be cats and cats will be cool			Mike Meyer
Cats can be callous and cats can be cruel		mwm@relay.pa.dec.com
Cats will be cats, remember this words!			decwrl!mwm
Cats will be cats and cats eat birds.
Technical Details
Message-ID: <MWM.90Nov21102909@raven.relay.pa.dec.com>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!cbmvax!bagate!dsinc!unix.cis.pitt.edu!zaphod.mps.ohio-state.edu!swrinde!ucsd!pacbell.com!ames!haven!decuac!bacchus.pa.dec.com!bacchus!mwm
References: <dillon.7256@overload.Berkeley.CA.US> <1990Nov15.170810.5868@sisd.kodak.com> <dillon.7260@overload.Berkeley.CA.US> <1990Nov19.130657.19380@sisd.kodak.com> <90324.204949GIAMPAL@auvm.auvm.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!cbmvax!bagate!dsinc!unix.cis.pitt.edu!zaphod.mps.ohio-state.edu!swrinde!ucsd!pacbell.com!ames!haven!decuac!bacchus.pa.dec.com!bacchus!mwm
From: mwm@raven.relay.pa.dec.com (Mike (My Watch Has Windows) Meyer)
Newsgroups: comp.sys.amiga.tech
Subject: Re: C compilers code generation
Message-ID: <MWM.90Nov21102909@raven.relay.pa.dec.com>
Date: 21 Nov 90 18:29:09 GMT
References: <dillon.7256@overload.Berkeley.CA.US>
 <1990Nov15.170810.5868@sisd.kodak.com>
 <dillon.7260@overload.Berkeley.CA.US>
 <1990Nov19.130657.19380@sisd.kodak.com>
 <90324.204949GIAMPAL@auvm.auvm.edu>
Sender: news@wrl.dec.com (News)
Organization: Missionaria Phonibalonica
Lines: 28
In-Reply-To: GIAMPAL@auvm.auvm.edu's message of 21 Nov 90 01:49:49 GMT