Declaring constants within the scope of a class
From: Generic Usenet Account (usenet_at_sta.samsung.com)
Date: 03/15/05
- Next message: Generic Usenet Account: "Wildcard handling with STL"
- Previous message: Victor Bazarov: "Re: Compile time constants - few questions..."
- Next in thread: Shezan Baig: "Re: Declaring constants within the scope of a class"
- Reply: Shezan Baig: "Re: Declaring constants within the scope of a class"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 15 Mar 2005 08:11:13 -0800
I am trying to compile the following sample code:
class WhatISHappeningHere
{
static const int x = 32;
static const char* yy = "Howdy";
// ...
// blah blah blah
// ...
};
My GCC compiler (g++ version 2.95.2) is giving the following misleading
compiler error:
ANSI C++ forbids in-class initialization of non-const static member
`yy'
I suspect that initialization of static data members that are not of an
integral type is not allowed in C++, but the compiler is giving a wrong
error message. Kindly confirm/refute my observation.
Thanks,
Gus
- Next message: Generic Usenet Account: "Wildcard handling with STL"
- Previous message: Victor Bazarov: "Re: Compile time constants - few questions..."
- Next in thread: Shezan Baig: "Re: Declaring constants within the scope of a class"
- Reply: Shezan Baig: "Re: Declaring constants within the scope of a class"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|