On Wed, Feb 25, 2026 at 11:32:41AM -0500, Bill Gray wrote: > > > 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" :
I recall getting bit when I assumed it would always work. (obviously, something dating from the 1990s :-) > 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 :-) ...MinGW(32) seems to have stopped updates 4-5 years ago. msys2 and cygwin get updates (though as I recall, using stable versions - unlike Fedora and Debian) > > 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... sometimes I miss an item, but not often enough to recall the last omission > Thanks! -- Bill > -- Thomas E. Dickey <[email protected]> https://invisible-island.net
signature.asc
Description: PGP signature
