Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!samsung!munnari.oz.au!metro!ipso!runxtsa!brucee From: brucee@runxtsa.runx.oz.au (Bruce Evans) Newsgroups: comp.lang.c Subject: Compile-time initialization (was Re: Is this bad programming?) Keywords: #define array definition Message-ID: <2157@runxtsa.runx.oz.au> Date: 11 Aug 90 05:50:11 GMT References: <1990Aug8.100614.1223@resam.dk> <17300@haddock.ima.isc.com> Organization: RUNX Unix Timeshare. Sydney, Australia. Lines: 26 In article <17300@haddock.ima.isc.com> karl@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@runxtsa.runx.oz.au UUCP: uunet!runxtsa.runx.oz.au!brucee (My other address (evans@ditsyda.oz.au) no longer works)