From 4286223203123974820
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,942dd48e323646a4
X-Google-Attributes: gidf78e5,public
From: Francis Glassborow <francis@robinton.demon.co.uk>
Subject: Re: const static member in a class
Date: 2000/04/28
Message-ID: <jRZNYBDqKCC5Ewpe@robinton.demon.co.uk>#1/1
X-Deja-AN: 616367370
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
References: <3908CCBC.E02307C@hotmail.com>
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Complaints-To: abuse@demon.net
X-Mail2News-Path: news.demon.net!mulga.cs.mu.oz.au
X-Trace: mail2news.demon.co.uk 956847131 mail2news:9970 mail2news mail2news.demon.co.uk
Organization: Southfield Microcomputer SS
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
MIME-Version: 1.0
Reply-To: Francis Glassborow <francisG@robinton.demon.co.uk>
Newsgroups: comp.std.c++

In article <3908CCBC.E02307C@hotmail.com>, Yaxun Liu
<yx_liu@hotmail.com> writes
>Hi,
>  I wonder whether the following codes satisfy the C++ standard,
>
>class A
>{
>public:
>static const int m_a=1;
>};
>
>I've seen some people used such codes, however, it caused compling error
>
>in VC++5.0. I was rather confused.

This one is not really MS's fault as in class initialisation of static
const data (integer types only) was a late tweak to the Standard.  In
addition you still have to define the variable exactly once somewhere in
your program (for the linker)
 

Francis Glassborow      Association of C & C++ Users
64 Southfield Rd
Oxford OX4 1PA          +44(0)1865 246490
All opinions are mine and do not represent those of any organisation

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]




