Article View: comp.unix.programmer
Article #3644Re: #ifndef/#ifdef problems in my header file (conditional header inclusion)
From: James Youngman
Date: Fri, 03 Jan 1997 00:00
Date: Fri, 03 Jan 1997 00:00
25 lines
2161 bytes
2161 bytes
In article <gnusenetraub-2412960039190001@dialup52.afn.org>, raub@kushana.aero.ufl.edu says... [ ... ] What I am >finding out is that is not the case. Running C programs that have similar >conditional including of header files in gcc (Sparc), Think C (Mac), Borland >TC++ 3.1 for Windows (PC), and SAS/C (Amiga) results in the same thing. It >really seems that the compiler simply *forgets* what was defined in the >previous .c file and define them all over again. That's the way it's supposed to work. It's called "separate compilation". >As a result, my object files >become unnecessarily large. Yes, the executable seems to take care of that, >but still I am using more disk space than I should. I am open for suggestions >as usual. Make sure you don't put *definitions* or *initialisations* in header files, just *declarations*. -- James Youngman VG Gas Analysis Systems |The trouble with the rat-race Before sending advertising material, read |is, even if you win, you're http://www.law.cornell.edu/uscode/47/227.html|still a rat.
Technical Details
Message-ID:
<5aitgq$j1e@halon.vggas.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<gnusenetraub-2412960039190001@dialup52.afn.org>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,157ed6c64d1aa006 X-Google-Attributes: gid11318c,public X-Google-Thread: 101ec9,8f16387167a7efa5 X-Google-Attributes: gid101ec9,public X-Google-Thread: fc89c,8f16387167a7efa5 X-Google-Attributes: gidfc89c,public X-Google-Thread: ffc26,8f16387167a7efa5 X-Google-Attributes: gidffc26,public X-Google-Thread: 105df1,8f16387167a7efa5 X-Google-Attributes: gid105df1,public X-Google-Thread: 1014db,8f16387167a7efa5 X-Google-Attributes: gid1014db,public From: JYoungman@vggas.com (James Youngman) Subject: Re: #ifndef/#ifdef problems in my header file (conditional header inclusion) Date: 1997/01/03 Message-ID: <5aitgq$j1e@halon.vggas.com> X-Deja-AN: 207456091 distribution: world references: <gnusenetraub-2412960039190001@dialup52.afn.org> content-type: Text/Plain; charset=US-ASCII organization: VG Gas Analysis Systems mime-version: 1.0 newsgroups: comp.unix.programmer,gnu.gcc.help,comp.lang.c,comp.sys.mac.programmer.help,comp.os.ms-windows.programmer.misc,comp.sys.amiga.programmer