Compile-time initialization (was Re: Is this bad programming?)

Bruce Evans brucee at runxtsa.runx.oz.au
Sat Aug 11 15:50:11 AEST 1990


In article <17300 at haddock.ima.isc.com> karl at kelp.ima.isc.com (Karl Heuer) writes:
>I recently proposed an extension to allow labeled initializers:
>	#define FILE_FOOTER_ERROR  1
>	#define DRAW_FOOTER_ERROR  2
>	char errortext[3][40] = {
>	    0:                 "234567890123456789012345678901234567890",
>	    DRAW_FOOTER_ERROR: "Draw footer error",
>	    FILE_FOOTER_ERROR: "File footer error",
>	};
>This might make it into gcc (and maybe from there into C-2001?).

What about allowing initialization by assignment?

	char errortext[3][40];
	...
	errortext[0] = "234567890123456789012345678901234567890";
	...
	errortext[DRAW_FOOTER_ERROR = "Draw footer error";
	...
	errortext[FILE_FOOTER_ERROR = "File footer error";

And similarly for structures.
-- 
Bruce Evans
Internet: brucee at runxtsa.runx.oz.au    UUCP: uunet!runxtsa.runx.oz.au!brucee
(My other address (evans at ditsyda.oz.au) no longer works)



More information about the Comp.lang.c mailing list