Storage space of #defines

Storage space of #defines

Post by Ms Rullg » Sat, 07 Aug 2004 16:34:12

Emmanuel Delahaye < XXXX@XXXXX.COM > writes:

I meant free some memory in the preprocessor. If a macro in undefined
there is no point in keeping the definition. Obviously it won't
change the compiled code.

Ms Rullgd

Storage space of #defines

Post by Chris McDo » Sat, 07 Aug 2004 16:48:16

=?iso-8859-1?q?M=E5ns_Rullg=E5rd?= < XXXX@XXXXX.COM > writes:

I would suggest that it you're that short of memory, then you'll have
far bigger problems down the track.

Dr Chris McDonald E: XXXX@XXXXX.COM
Computer Science & Software Engineering W: ~chris
The University of Western Australia, M002 T: +618 6488 2533
Crawley, Western Australia, 6009 F: +618 6488 1089


Storage space of #defines

Post by Pascal Bou » Sat, 07 Aug 2004 16:48:49

Ms Rullgd < XXXX@XXXXX.COM > writes:

But, since program sources are expected to be finite, it would be
perfectly reasonable to avoid any garbage collection in a C
preprocessor. In addition, if the source is memory mapped and the
scanner directly refers the source with (pointer,length) couples
instead of copying the tokens, then there is even no memory to garbage

What I mean is that it should really be the least of a programmer's

__Pascal Bourguignon__

Nobody can fix the economy. Nobody can be trusted with their finger
on the button. Nobody's perfect. VOTE FOR NOBODY.

Storage space of #defines

Post by Ms Rullg » Sat, 07 Aug 2004 17:20:18

Pascal Bourguignon < XXXX@XXXXX.COM > writes:

The preprocessor has to keep some kind of table of all defined macros,
a hash table seeming reasonable. Even if no extra memory is used for
storing the actual macro name and expansion, the pointers to those
would use a small amount of memory. Obviously this is implementation
dependent, so I checked the source code of GCC. After a quick look it
is obvious that it uses some memory to hold macro definitions.
Undefining a macro seems to release the memory to an internal pool for
future use by other macros, but does not free() it.


Ms Rullgd