putting stuff in the text segment

T. William Wells bill at proxftl.UUCP
Mon Jun 13 05:51:10 AEST 1988


In article <1457 at laidbak.UUCP>, daveb at laidbak.UUCP (Dave Burton) writes:
) In article <3813 at lynx.UUCP> m5 at lynx.UUCP (Mike McNally) writes:
) |Does a widely-accepted syntax extension to put data structures in the
) |text segment exist?  We are thinking about adding something like this
) |to our compiler in order to reduce memory use by oft-forked large
) |applications.  I had in mind a couple of new storage classes, maybe
) |"rom" and "staticrom".

The const keyword of Standard C, when applied to a statically
allocated variable, implies that one can place the variable in a
read-only segment; even if your text segments are read-only, any
variable marked const could be placed there.

Otherwise, you could define various qualifiers which can be used
like const but which specify a segment instead of an attribute.
Like defining storage new storage classes (actually new storage
class modifiers), this is relatively innocuous; porting to
another system just requires adding some #defines to get rid of
the new keywords.



More information about the Comp.lang.c mailing list