Hi Robert,

I think in VS, specifiying something as just unsigned causes the
compiler to read "unsigned int".

If you change the line to

return static_cast<unsigned long const volatile &>(_value);

I think the warning will disappear.

Cheers,
Morne

On Tue, Feb 3, 2009 at 2:48 PM, Robert Osfield <robert.osfi...@gmail.com> wrote:
> Hi Windows experts,
>
> Here's another Windows warning that I'll like a hand resolving:
>
> 2>..\common\Atomic.cpp(133) : warning C4239: nonstandard extension
> used : 'static_cast' : conversion from 'volatile const long' to
> 'volatile const unsigned int &'
>
> The code is:
>
> Atomic::operator unsigned() const
> {
> #if defined(_OPENTHREADS_ATOMIC_USE_GCC_BUILTINS)
>    __sync_synchronize();
>    return _value;
> #elif defined(_OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED)
>    MemoryBarrier();
>    return static_cast<unsigned const volatile &>(_value);
>    <<<< Here is line 133, problem line.
> #elif defined(_OPENTHREADS_ATOMIC_USE_BSD_ATOMIC)
>    OSMemoryBarrier();
>    return static_cast<unsigned const volatile>(_value);
> #else
> # error This implementation should happen inline in the include file
> #endif
> }
>
> To me a fix would be to remove the & from the static_cast<unsigned
> const volatile &> as it seems a tad superfluous in this method as it's
> returning an unsigned int on the stack anyway.
>
> Thoughts?
> Robert.
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to