cottrell@nbs-vms.ARPA (01/11/85)
/* bizarre idea time again! how about a 'data' statement? except we wouldn't call it that. have a bunch of code before (outside) any functions are defined. only stuff that the compiler could do as initialization (if the syntax allowed it) would be legal. what am i talking about? try this: int x[4]; union dues { char p; int q; float r; }; } z; /* ignore prev line, typing directly */ ... x[3] = 1; z.r = 3.14159; ... int func() { ... } one could even imagine for loops to initialize arrays, but this would require the compiler to be an interpreter as well. oh well. */
peterc@ecr2.UUCP (Peter Curran) (06/07/85)
While we are on the subject of initialization... Does the C standard address the issue of initializing large arrays. Does it have something like the Fortran syntax "5 * 5" to initialize five elements to the same value? I realize you can type them in if you really know the size, but that doesn't work too well if you want the size to be controlled by a #define. The solution right now is to write initialization code, either to run when the program is started, or as a preprocessor of some sort generating the required C code. Neither is very satisfactory.