www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript

c++ - Suppressing warning 6 without disabling it

↑ ↓ ← "Johnny Willemsen" <jwillemsen remedy.nl> writes:
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
Sep 23 2004
"Włodzimierz Skiba" <abx abx.art.pl> writes:
"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
Sep 23 2004
↑ ↓ → "Johnny Willemsen" <jwillemsen remedy.nl> writes:
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

Sep 24 2004
→ "Walter" <newshound digitalmars.com> writes:
"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,

 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

 of warning 6, with such a macro, we don't want do disable it completely.

-w6 see www.digitalmars.com/ctg/sc.html#dashw
Sep 30 2004