🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #2132

Re: Aggregate Initialization **NOT**

#2132
From: Norman Diamond
Date: Thu, 15 Oct 1992 02:57
32 lines
2335 bytes
In article <1992Oct14.171711.1655@lub001.lamar.edu> wagner@lub001.lamar.edu writes:
>In my code I have a statment similar to the following:
>	int array_name[] = {value,value,value,...};
>Now, this statement is correct in every reference I can find, but when I
>compile it the compiler returns an error and says that aggregate
>initialization is not allowed.

If you're using a pre-ANSI compiler, then the reference you should look in
is K&R's first edition.  Initialization of AUTO aggregates (defined inside
a block, without "static" or "extern" storage class) was not allowed in
those days.

If your declaration is at file scope (not inside a block), and/or if it
DOES say "static" or "extern", then get a refund for your compiler.
Regardless of where your declaration is, if you're using a compiler that
is claimed to be ANSI conforming, then get a refund.  [Personal opinions only.]

Otherwise, try it with an ANSI conforming compiler.  There are two conforming
or "almost" conforming implementations for your platform.  (There's no such
thing as "almost" conforming, but my personal opinion is that one comes
pretty close, and I don't have enough experience with the other.)

>My question is: Is this a bug with my compiler or is it just a sucky compiler!

If it's a pre-ANSI compiler, then it's just a sucky language, and maybe
user who chooses to use a pre-ANSI compiler.  If the compiler is asserted
(by its vendor) to be ANSI conforming, then it's a sucky compiler.
[Personal opinions only.]
--
Norman Diamond       diamond@jit081.enet.dec.com
If this were the company's opinion, I wouldn't be allowed to post it.
"Yeah -- bad wiring.  That was probably it.  Very bad."
Technical Details
Message-ID: <1992Oct15.025736.22358@nntpd.lkg.dec.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!sgiblab!darwin.sura.net!haven.umd.edu!decuac!pa.dec.com!engage.pko.dec.com!nntpd.lkg.dec.com!jit345.bad.jit.dec.com!diamond
References: <1992Oct14.171711.1655@lub001.lamar.edu>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!sgiblab!darwin.sura.net!haven.umd.edu!decuac!pa.dec.com!engage.pko.dec.com!nntpd.lkg.dec.com!jit345.bad.jit.dec.com!diamond
From: diamond@jit345.bad.jit.dec.com (Norman Diamond)
Subject: Re: Aggregate Initialization   **NOT**
Message-ID: <1992Oct15.025736.22358@nntpd.lkg.dec.com>
Sender: usenet@nntpd.lkg.dec.com (USENET News System)
Reply-To: diamond@jit.dec.com (Norman Diamond)
Organization: Digital Equipment Corporation Japan , Tokyo
References: <1992Oct14.171711.1655@lub001.lamar.edu>
Date: Thu, 15 Oct 1992 02:57:36 GMT
Lines: 32