On 2/24/26 18:40, Thomas Dickey wrote:
On Tue, Feb 24, 2026 at 05:55:57PM -0500, Bill Gray wrote:
(snip) It is recommended that any code depending on them be
conditioned using NCURSES_VERSION."

fwiw, I see there are 32 pages with that advice

True. My question was just about 'new pair', but I was actually thinking more generally, and your reply tells me what I'll need to know for future cases of this ilk.>
        #if defined(NCURSES_PATCH) && NCURSES_PATCH >= 20170311

   At least with GCC,  OpenWATCOM,  and Digital Mars,  "identifiers that are not 
macros... are all considered to be the number zero" :

https://gcc.gnu.org/onlinedocs/gcc-3.0.2/cpp_4.html#SEC38

   which lets you get away with

#if NCURSES_VERSION_PATCH >= 20170311

   I _think_ only PDCurses* and 20170311-and-later ncurses support the 
functions,  so the full test would be

#if NCURSES_VERSION_PATCH >= 20170311 || __PDCURSES__

would be precise.  Most people could just test NCURSES_VERSION :-)
On the other hand, MacOS has ncurses 6, but the header says 20150808,
(checking a local machine) so portable code should also check NCURSES_PATCH.

   The issue came up here :

https://github.com/Bill-Gray/PDCursesMod/issues/364

   Seems MinGW uses 6.0.20150808,  and a PDCursesMod demo using those functions (a 
"pretty picture" program showing the Mandelbrot set) failed to compile with 
that elderly version of ncurses.  You can't really escape your past :-)

curses.h has the compile-time stuff (quoting from Debian 13):

/* These are defined only in curses.h, and are used for conditional compiles */
#define NCURSES_VERSION_MAJOR 6
#define NCURSES_VERSION_MINOR 5
#define NCURSES_VERSION_PATCH 20250216

and I added curses_version as well as -V options long ago, for sanity checks.

But the conditioned-on verbiage in the man pages came from Eric,
and I had found no reason to make it more complicated.

   Yes,  I don't know how common such oddities are.  The above MinGW example is 
probably rather unusual.  I'd expect MacOS might cause grief,  though.
The header file is the place to look, along with NEWS to see when a feature
was added (usually complete, and easier to work with than looking through
the source history).

   Exactly.  I shoulda thought of NEWS...

Thanks!        -- Bill

Reply via email to