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