On 07/02/2013 12:07 AM, Tom Breton (Tehom) wrote:
>   * These spurious warnings happened because some arguments like "file" and
> "line" were used just if DEBUG_SEQUENCE_MANAGER was defined.  AFAICT,
> it's either spurious warnings, something like this, something uglier, or
> a non-trivial rewrite.

   The customary way to handle this situation is as follows:

void f(int i)
{
#ifdef DEBUG_SEQUENCE_MANAGER
     RG_DEBUG << i;
#else
     i;  // suppress compiler warning
#endif

     // ...
}

   It's a very common idiom.  It's only needed where there might be 
warnings, and that is typically only in a few cases.  Sometimes an ARG() 
#define (or similar) is used for this:

#else
     // Just expands to i;
     ARG(i);  // suppress compiler warning
#endif

   Though I think the direct approach above is better as it doesn't hide 
the language from someone who is learning it.

Ted.

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Rosegarden-devel mailing list
Rosegarden-devel@lists.sourceforge.net - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-devel

Reply via email to