"BobR" <> wrote in message
news:0Lzph.691980$...
>
> Colander wrote in message ...
>>Jim Langston wrote:
>>> If each compiliation unit is to have it's own copy of the variable then
> make
>>> it static.
>>> static whatever class[SIZE];
>>> If each compiliation unit is to share the one instance of the variable,
> then
>>> declare it external:
>>> extern whatever class[SIZE];
>>> and in one, and only one, compilation unit (one of the .cpp files)
>>> declare
>>> it as a normal global variable:
>>> whatever class[SIZE];
>>
>>I think you overlooked that in C++ class is an keyword, in C it isn't.
>>
>>so Legal c code:
>>int class = 42;
>>And illegal C++ code:
>>int class = 42;
>>
>>Yes there are things that C can do that C++ can't...
>
> So, in C, this is legal?
>
> int struct = 42;
You're absolutely right, I just typed in the OP's variable name on auto
pilot. Yeah, can't use any keyword as a var name (including struct).
So, no, int struct = 42; is not legal in c++
|