home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!polstra!jdp
- From: jdp@polstra.uucp (John Polstra)
- Subject: Initialization {} of Aggregates with Static Members
- Message-ID: <BzA5oG.Bwu@polstra.uucp>
- Organization: Polstra & Co., Inc., Seattle, WA
- Date: Tue, 15 Dec 1992 03:00:15 GMT
- Lines: 30
-
- I'd like some opinions on something that the ARM doesn't seem to address
- directly:
-
- struct X {
- int a;
- static int b;
- int c;
- };
-
- X foo = { 1, 3 };
-
- I believe that this is legal, and that foo.a and foo.c should get
- the values 1 and 3, respectively. Static member b should remain
- uninitialized by the code shown here; it would have to be defined
- exactly once elsewhere in the program.
-
- ARM section 8.4.1 doesn't say such cases are illegal, but it doesn't really
- say what to do about them either.
-
- Cfront, High C/C++, Microsoft C++ 7.0 seem to agree with me. Furthermore,
- the class library provided by Microsoft relies on this behavior. G++ 2.3.2
- for i386-att-sysv4 generates bad stuff that causes the assembler to become
- indignant.
-
- Comments and/or ARM citations, anyone?
- --
- John Polstra polstra!jdp@uunet.uu.net
- John D. Polstra & Co., Inc. ...!uunet!polstra!jdp
- Seattle, Washington USA Phone (206) 932-6482, FAX (206) 935-1262
- "Self-knowledge is always bad news." -- John Barth
-