K&R says on page 40 that "the result is implementation-defined if an attempt is made change a const." On page 211, it says that such objects "may" be placed in read only memory. As far as I know, it's unusual for a compiler to actually do so.
On Fri, Apr 20, 2007 at 04:22:23PM -0400, Glenn Fowler wrote: > > I've been at this so long you think I should know better > > I've been under the apparently mistaken assumption that > if I dilligently pepper struct definitions and subsequent > declarations and initializations with "const" that the compiler > will attempt to place that data in readonly text > > I've done this with the libast tables in conftab.c lc.c > but nm and size show the data going to the .data section > > am I expecting too much from cc to do this without prodding? > is there a set of options that at least works for gcc on > multiple architectures? or at least for solaris and the ksh93 > integration? > > thanks > > -- Glenn Fowler -- AT&T Research, Florham Park NJ -- > > _______________________________________________ > ast-users mailing list > ast-users at research.att.com > https://mailman.research.att.com/mailman/listinfo/ast-users -- Peter Fales Alcatel-Lucent Member of Technical Staff 2000 Lucent Lane Room: 1C-436 Naperville, IL 60566-7033 Email: psfales at alcatel-lucent.com Phone: 630 979 8031