class A{static const int b = 1; };

W

WW

I read in "Thinking in C++" this code works:
---------
class A
{
static const int b = 1;
};

No. VC6 is non-standard in this matter. The usual fix is the enum-as-const
"idiom". Just do it like this:

class A
{
enum { b = 1; };
};
 
W

WW

Victor said:
enum { b = 1 };

Thanks for the correction. I forgot to remove the ;. It is so little I did
not see it is there. That is again a proof that size does not matter ;-)
 
W

WW

Alexander said:
Victor Bazarov wrote:
[...]
enum { b = 1 };

"The actual eyeballs, lying within an ea^H^H^H^H^HBazarov's skull, are
huge by our standards, taking up more room than the brain itself!"

I assume Alexander meant you have eagle eyes. And nothing about Victor's
brain.

Alexander, you will really need a bodyguard. My father has jokes like this
and the people of his village did confess to me that they have sometimes
played with the idea to check if his brain differs from a normal one. ;-)
 
A

Alexander Terekhov

WW wrote:
[...]
I assume Alexander meant you have eagle eyes. And nothing about Victor's
brain.

Let me put it this way. Judging from Bazarov's "subdue" c.l.c++-policing
activity of lately, his medical treatment looks really promising. To me,
it seems like he'll reach the level of NeilB really soon. Amen. Default,
be ready (never mind your days are coming too).

http://groups.google.com/[email protected]

regards,
alexander.
 
G

Gianni Mariani

Alexander said:
WW wrote:
[...]
I assume Alexander meant you have eagle eyes. And nothing about Victor's
brain.


Let me put it this way. Judging from Bazarov's "subdue" c.l.c++-policing
activity of lately, his medical treatment looks really promising. To me,
it seems like he'll reach the level of NeilB really soon. Amen. Default,
be ready (never mind your days are coming too).

http://groups.google.com/[email protected]

So what did end up happening to the butter man. Is he Alexander now ?
 
S

Shane Beasley

I read in "Thinking in C++" this code works:
---------
class A
{
static const int b = 1;
};

<http://www.comeaucomputing.com/tryitout/> compiles it just fine. If
you're going to use a compiler as a measure of code correctness, use
that one. :)
I do something wrong?
I use VC++6 and it returns:

VC++6 is wrong. VC++.NET compiles it.

In the short term, maybe try this instead:

class A { enum { b = 1 }; };

Or, if you don't need it as a compile-time constant (e.g., for use as
a template parameter, size of an array, etc.), initialize it when you
define it in a .cpp file:

// A.h
class A {
static const int b;
};

// A.cpp
const int A::b = 1;

- Shane
 
V

Victor Bazarov

WW said:
Victor said:
WW said:
[...]
I assume Alexander meant [...]

He didn't mean anything. He can't mean anything.
He has no device with which to mean.

I see. He has no device with which to mean. So he cannot be mean. ;-)

Nah. It's actually simpler. He cannot be. Unless you let him,
by replying to his nonsense. Two more times and you (and others
feeding that idiot troll) will probably join him in my killfile.
You don't have to care about that. I'm just pondering.
 
W

WW

Victor said:
Nah. It's actually simpler. He cannot be. Unless you let him,
by replying to his nonsense. Two more times and you (and others
feeding that idiot troll) will probably join him in my killfile.
You don't have to care about that. I'm just pondering.

If you killfile me I cannot send you my C++ language proposal for review.
It would be shame. How do you expect *me* to get it right? Drop me a mail
if you think you would have time and want to look at something like that.

BTW I was not trying to feed any troll, I was trying to keep the tension
down. Well, remind me time to time to not seek for a carrier in marriage
concunciling. :-(
 
A

Alexander Terekhov

Victor said:
WW said:
Victor said:
[...]
I assume Alexander meant [...]

He didn't mean anything. He can't mean anything.
He has no device with which to mean.

I see. He has no device with which to mean. So he cannot be mean. ;-)

Nah. It's actually simpler. He cannot be. Unless you let him,
by replying to his nonsense. Two more times and you (and others
feeding that idiot troll) will probably join him in my killfile.

Aha. How scary.
You don't have to care about that. I'm just pondering.

Medication, Bazarov. Take a dose of anti-hysteria pills.

regards,
alexander.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top