[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

slk_attr_off and on macros

From: Jim Idle
Subject: slk_attr_off and on macros
Date: Wed, 17 Mar 2004 08:21:05 -0800

When building with widec options, ncurses 5.4, latest patches (but the very 
latest one), the slk_attr macros are defined as:

 * Some wide-character functions do not depend on the extensions.

#define slk_attr_off(a,v)       ((v) ? ERR : slk_attroff(a))
#define slk_attr_on(a,v)        ((v) ? ERR : slk_attron(a))

If one then uses them in this manner:

        retcode = slk_attr_off(attr, (void *)NULL);

Which seems to be what the standards require, then the macros cause slightly 
annoying warnings to be generated with some compilers, such as xlc_r on AIX:

xlc_r softkeys.c
"softkeys.c", line 37.19: 1506-425 (I) The condition is always false.
"softkeys.c", line 71.19: 1506-425 (I) The condition is always false.

I guess that the macro is trying to prevent people passing in values other then 
a NULL pointer of course. This warning can be turned off with the appropriate 
#pragma, but perhaps taking out the test and just throwing away the v parameter 
would be better? 

I can see why it was done like this, and it makes sense to have done it, but 
perhaps we can rely on the programmer passing in NULL as per the specs? Hmm, 
relying on other programmers to do the right thing... ;-)

Jim Idle

Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.618 / Virus Database: 397 - Release Date: 3/9/2004

reply via email to

[Prev in Thread] Current Thread [Next in Thread]