Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!rutgers!orstcs!nucthy.physics.orst.edu!sagen From: sagen@nucthy.physics.orst.edu (Milt Sagen) Newsgroups: comp.sys.mac.programmer Subject: Initializing automatic arrays Keywords: MPW-C, LSC, versions 3.0 Message-ID: <9226@orstcs.CS.ORST.EDU> Date: 5 Mar 89 15:26:11 GMT Sender: usenet@orstcs.CS.ORST.EDU Reply-To: sagen@nucthy.physics.orst.edu (Milt Sagen) Distribution: na Organization: Dept. of Physics, Oregon State University Lines: 42 If I compile the following code segment with MPW-C 3.0 using 'c -c file.c' no errors are reported. However, when I compile it with LSC 3.0 it reports an error because the array is unindexed. If I put in 6 as the index then LSC reports an error for trying to initialize an automatic array. According to K&R (1st edition) automatic arrays cannot be initialized. What does K&R's 2nd edition and the ANSI standard say about this? Is this a bug in the MPW C compiler? Or is Apple following the ANSI standard on this, while THINK Technologies follows K&R? I couldn't find anything in the MPW-C manual about initializing automatic arrays. One last thing before I show you the code fragment: MPW-C leaves a .o file, of length 0K, in the directory when I compile with the -c option (no code generation option). Is this a bug, feature, oversight, or what? #ifdef THINK_C #define real double #else #define real extended #endif real XFactorial( x ) real x ; { real coef[] = ( 76.18009173, -86.50532033, 24.01409822 -1.231739516, 0.120858003e-2, 0.536382e-5 ) ; : : : } Milt Sagen Internet: sagen@nucthy.physics.orst.edu Department of Physics Oregon State University Corvallis, OR 97331 Tele: (503) 754-4631