[Media_api] Some #pragmas for Windows

Olivier Tristan o.tristan at ultimatesoundbank.com
Fri May 4 11:37:48 PDT 2007


Roger Dannenberg wrote:
> Peter,
>    I once tried to write code that would issue no warnings, and ended 
> up going in circles -- changes that eliminated warnings on one 
> platform would generate them on another. Sounds impossible, but a good 
> example is one compiler knows that an exception or longjump jumps out 
> of a function, so a following return stmt is unreachable code, whereas 
> another compiler will know nothing about the exception and complain 
> that you aren't returning a value. Anyway, I agree we should try to 
> turn off warnings that are not warning us about real bugs. The trick 
> is to be cross-platform and not turn off the possibility of getting 
> new useful warnings in the future. If anyone knows the best way to do 
> this or even a solid "best practices" approach, please let me know.
>
Hi Roger,

I would put the #pragma inside an #if defined(_MSC_VER)
You can check for the _MSC_VER if you just want to use those pragma for 
a specific version of VC.

Here is an example:

#if defined(_MSC_VER)
    #pragma warning( disable : 4290 ) // we don't care about exception 
specification ignored
#endif


HTH

-- 
Olivier Tristan
Ultimate Sound Bank



More information about the media_api mailing list