A problem with comctl32

Rolf Kalbermatter rolf.kalbermatter at citeng.com
Mon Nov 4 07:18:23 CST 2002


> >>-    const INT lx = himl->cx * pimldp->i + pimldp->xBitmap;
> >>-    const INT ly = pimldp->yBitmap;
> >>+    static INT lx;
> >>+    static INT ly;
> >>    
> >>
> >
> >Should this be really static? Can't this function be called reentrant?
> >
> >  
> >
> well, static is no worse than const ;)
> but I'll leave that to dimitrie.
> I was simply trying to cause as few changes as possible, and changing it 
> to static would make it a global , rather than
> a stack variable, the same as const.

There is a huge distinction between static and const. static is allocated
on the heap as global as you say and that means bad things will happen when
the function is called in parallel from several threads.

const basically is only a compiler restriction which prevents the programmer
to change the value of a variable after it is initialized. That's why you had
to remove it as otherwise the compiler complained that the variable assignement
later on would not be valid. But the const variable is still allocated on the
stack and therefore threadsafe.

Rolf Kalbermatter



More information about the wine-devel mailing list