home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / c / 20064 < prev    next >
Encoding:
Text File  |  1993-01-22  |  1.5 KB  |  43 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!pipex!mfmail!dnh
  3. From: dnh@mfltd.co.uk (Des Herriott)
  4. Subject: Re: Few simple questions
  5. Message-ID: <1993Jan22.110501.15940@mfltd.co.uk>
  6. Sender: dnh@mfltd.co.uk (Des Herriott)
  7. Organization: Micro Focus Ltd., Newbury, UK
  8. References: <1993Jan21.001022.46578@kuhub.cc.ukans.edu> <TOMSTER.93Jan21220733@bigwpi.WPI.EDU>
  9. Date: Fri, 22 Jan 1993 11:05:01 GMT
  10. Lines: 31
  11.  
  12.  
  13. In article <TOMSTER.93Jan21220733@bigwpi.WPI.EDU>, tomster@bigwpi.WPI.EDU (Thomas Richard Dibble) writes:
  14. >
  15. > > [ Example of automatic array initialisation ]
  16. > Well, the problem (I am somewhat sure) is your compiler.  If I have
  17. > the story right, this is not in the ANSII standard, and so
  18. > "ANSII-compatible" compilers need not implement it.  The only solution
  19. > I know of is to put it into a function called right off the bat or
  20. > switch compilers.
  21.  
  22. You're sort of right, but on the wrong track...
  23.  
  24. Automatic array initialisation is legal in ANSI standard C.  That is, a statement like 
  25.   
  26.   int x[3] = { 1, 2, 3 };
  27.  
  28. is perfectly OK.  It's not, however, legal in pre-ANSI (Common) C.  The best
  29. way around this is either get an ANSI-C compiler, or if that's not an option,
  30. make the offending aggregate a static variable - that's allowed.
  31.  
  32. By the way, what's a "function called right off the bat" ?
  33.  
  34. Des.
  35.  
  36.  
  37. -- 
  38. Des Herriott,           /     "...and I hate, and I hate, and I hate,
  39. Micro Focus, Newbury.  /             elevator music..."
  40. +44 (0635) 565354     /
  41. dnh@mfltd.co.uk      /                   -- Tori Amos, Little Earthquakes.
  42.