From -881247203875226069
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,8ae5df0bebc425df
X-Google-Attributes: gidf78e5,public
From: Valentin Bonnard <Bonnard.V@wanadoo.fr>
Subject: Re: Is this legal C++...?
Date: 1999/03/30
Message-ID: <3700F06C.5F52@wanadoo.fr>#1/1
X-Deja-AN: 460795721
Content-Transfer-Encoding: 7bit
Approved: Fergus Henderson <fjh@cs.mu.oz.au>
References: <3700171e.20484763@news.ccnet.com>
X-Original-Date: Tue, 30 Mar 1999 17:40:28 +0200
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: news@news.unimelb.edu.au
X-Trace: izvestia.its.unimelb.edu.au 922810521 13937 128.250.29.17 (30 Mar 1999 16:15:21 GMT)
Organization: Ecole Normale Superieure, Paris, France
X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUANwD4g+EDnX0m9pzZAQGoFwGAhSOMb2l4KIRK79zJlKkxjWM9x+IBPHXr yxrRSYOnXPwFkF6Jh9zPpNvlBRqf7f87 =7aoJ
Mime-Version: 1.0
NNTP-Posting-Date: 30 Mar 1999 16:15:21 GMT
Newsgroups: comp.std.c++

Paul wrote:
> 
>    struct X{
>       static const int x=0;
>    };
> 
> While some compilers reject this, the standard seems to suggest
> that it is legal. See std. sec 9.4.4 and 3.1.

Yes, it's perfectly legal for constants of integral type (like int). 
Note that you also have to define X::x once in your program:

const int X::x;

-- 

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



