bug-ncurses
[Top][All Lists]
Advanced

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

Re: slk_attr_off and on macros


From: Thomas Dickey
Subject: Re: slk_attr_off and on macros
Date: Wed, 17 Mar 2004 15:36:10 -0500 (EST)

On Wed, 17 Mar 2004, Jim Idle wrote:

> 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?

yes, that would be ok.  The null parameter was one of those
committe-features that someone added in between the draft version and
release.  Not being on the committee, I can only guess what the intent of
the change was (if there was one ;-).

>
> 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... ;-)

I can recall some people insisting that ncurses shouldn't check its
arguments at all, on the grounds that null is just one of the possible
things that might be incorrect, and if none of the other values were
checked, checking for null is futile.

-- 
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net




reply via email to

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