From -4508344505304966765
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,942dd48e323646a4
X-Google-Attributes: gidf78e5,public
From: Ole Reinartz <ole.reinartz@gmx.de>
Subject: Re: const static member in a class
Date: 2000/05/31
Message-ID: <39338E39.2DA652BB@gmx.de>#1/1
X-Deja-AN: 629414635
Content-Transfer-Encoding: 7bit
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
References: <3908CCBC.E02307C@hotmail.com> <jRZNYBDqKCC5Ewpe@robinton.demon.co.uk> <392E5925.6BABB160@gmx.de> <OjNmU8AeYwL5EwHM@robinton.demon.co.uk>
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: abuse@demon.net
X-Mail2News-Path: news.demon.net!mulga.cs.mu.oz.au
X-Trace: mail2news.demon.co.uk 959773315 mail2news:25142 mail2news mail2news.demon.co.uk
Organization: Nokia
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
MIME-Version: 1.0
NNTP-Posting-Date: Tue, 30 May 2000 12:50:01 EET DST
Newsgroups: comp.std.c++



Francis Glassborow wrote:
[snip]
(snipped text acknowledged; you are right Francis, it only works as long as
nobody wants to have the address of that const)

> >(like it would do when you would #define m_a 1). Still
> >the type savety remains.
> >Also I think (didnt look it up in the standard though) that it works for all
> >the builtin types.
>
> You really should check the standard. A special rule was allowed for
> static const integer values because such values are often wanted as
> compile time constants (e.g. for an array size). enums were being used
> for named integer literals before this change was made.

Could you tell me where that is in the standard please? I only have the draft
from end of '96. There I cannot find anything about a special rule for static
const integer values. Furthermore the compiler I use (gcc of several versions;
2.7.2 to 2.95) allow me to in- class- initialize static const values of
char,short,long,float and double.

Thanks,
    Ole

---
[ 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              ]




