2012/3/25 Greg Ercolano <[email protected]>:
> On 03/24/12 14:39, Nikita Egorov wrote:
>> I think VS applies 'static' attribute only to first variable from list
>> ('no_fullscreen_x').
>
>        I'm not sure that's the problem, at least not as a general
>        case with 'static'. Though perhaps the DLL context is complicating
>        things.
>
>        Just for the record, the following compiled with VS2010:
>
> C:\temp>type foo.cxx
> #include <stdio.h>
> class Bar {
>    static int ca,cb,cc;        // static members in a class
> public:
>    Bar() {
>        ++ca; ++cb; ++cc;
>        printf("BAR: CA,CB,CC: %d\n", ca,cb,cc);
>    }
> };
> int Bar::ca = 100;
> int Bar::cb = 200;
> int Bar::cc = 300;
>
> void foo() {
>    static int a=1,b=1,c=1,d=1;         // static members in a function
>    printf("ABCD: %d %d %d %d\n", a,b,c,d);
>    a++; b++; c++; d++;
> }
> int main() {
>    foo(); foo(); foo();
>    new Bar();
>    new Bar();
>    new Bar();
>    return(0);
> }
>

Well, it's OK.
But if you insert "__declspec(dllexport)" before Bar (like in fltkdll
project) this code cannot be compiled by VS2010 (at least).

class __declspec(dllexport) Bar {
   static int ca,cb,cc;        // ERRORS !

The compiler prints two errors on 'cb' and 'cc' variables respectively.
It can process it only if every declaration is in new line.

class __declspec(dllexport) Bar {
   static int ca;
   static int cb;
   static int cc;

That works fine.
What is wrong in first version? I don't know yet...

-- 
Best Regards
Nikita Egorov
[email protected]

_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to