Thread overview | ||||||
---|---|---|---|---|---|---|
|
September 23, 2004 Suppressing warning 6 without disabling it | ||||
---|---|---|---|---|
| ||||
Hi, When building ACE/TAO I get the warning: Warning 6: value of expression is not used In ACE/TAO we use a macro ACE_UNUSED_ARG for arguments which are there, but not used under certain conditions. The macro is defined as # define ACE_UNUSED_ARG(a) do {/* null */} while (&a == 0) or # define ACE_UNUSED_ARG(a) (a) But both don't suppress the warning with DMC? Anyone an idea how to get rid of warning 6, with such a macro, we don't want do disable it completely. Johnny |
September 23, 2004 Re: Suppressing warning 6 without disabling it | ||||
---|---|---|---|---|
| ||||
Posted in reply to Johnny Willemsen | "Johnny Willemsen" <jwillemsen@remedy.nl> wrote in news:ciuli7$1d7s$1@digitaldaemon.com: > Anyone an idea how to > get rid of warning 6, with such a macro, we don't want do disable it > completely. In wxWidgets we have: #define WXUNUSED(identifier) #ifdef __BORLANDC__ # define wxUnusedVar(identifier) identifier #else template <class T> inline void wxUnusedVar(const T& WXUNUSED(t)) { } #endif and then write code which afaik works with all c++ compilers we support (including DMC): wxUnusedVar(some_variable); ABX |
September 24, 2004 Re: Suppressing warning 6 without disabling it | ||||
---|---|---|---|---|
| ||||
Posted in reply to W³odzimierz Skiba | Hi, Thanks for this, I have added such a construct also to ACE. I only observed that the template way of doing this, increases the size of the app a little, the do/while solution is optimized out by the compiler, the template probably not. Johnny "W³odzimierz Skiba" <abx@abx.art.pl> wrote in message news:ciurr4$1j0m$1@digitaldaemon.com... > "Johnny Willemsen" <jwillemsen@remedy.nl> wrote in news:ciuli7$1d7s$1@digitaldaemon.com: > >> Anyone an idea how to >> get rid of warning 6, with such a macro, we don't want do disable it >> completely. > > In wxWidgets we have: > > #define WXUNUSED(identifier) > > #ifdef __BORLANDC__ > # define wxUnusedVar(identifier) identifier > #else > template <class T> > inline void wxUnusedVar(const T& WXUNUSED(t)) { } > #endif > > and then write code which afaik works with all c++ compilers we support > (including DMC): > > wxUnusedVar(some_variable); > > ABX |
September 30, 2004 Re: Suppressing warning 6 without disabling it | ||||
---|---|---|---|---|
| ||||
Posted in reply to Johnny Willemsen | "Johnny Willemsen" <jwillemsen@remedy.nl> wrote in message news:ciuli7$1d7s$1@digitaldaemon.com... > Hi, > > When building ACE/TAO I get the warning: Warning 6: value of expression is not used > > In ACE/TAO we use a macro ACE_UNUSED_ARG for arguments which are there, but > not used under certain conditions. The macro is defined as > # define ACE_UNUSED_ARG(a) do {/* null */} while (&a == 0) > or > # define ACE_UNUSED_ARG(a) (a) > > But both don't suppress the warning with DMC? Anyone an idea how to get rid > of warning 6, with such a macro, we don't want do disable it completely. -w6 see www.digitalmars.com/ctg/sc.html#dashw |
Copyright © 1999-2021 by the D Language Foundation