putting stuff in the text segment

Guy Harris guy at gorodish.Sun.COM
Thu May 26 12:32:04 AEST 1988


> 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".

Try "const"; it's in the current ANSI C draft (and will probably be in future
ones), and "stick this in ROM" is one valid interpretation of it, as is "stick
this into the text segment".  You needn't feel obliged to implement all the
ANSI C semantics (such as "assignments to 'const' objects are disallowed, as
are sneaky back-door ways of doing those assignments") unless and until you
have an ANSI C compiler (but be prepared for them).

Grab the ANSI C spec for a detailed description; it's not a simple storage
class.



More information about the Comp.lang.c mailing list