On November 16, 2025 6:38 PM, Thomas Dickey wrote:
>On Sun, Nov 16, 2025 at 08:16:13PM -0500, [email protected] wrote:
>> >From: Thomas Dickey <[email protected]>
>> >Sent: November 16, 2025 12:40 PM
>> >To: [email protected]
>> >Cc: [email protected]; 'Ncurses Mailing List'
>> <[email protected]>
>> >Subject: Re: Contributions for HPE NonStop/Tandem
>> >
>> >On Sun, Nov 16, 2025 at 11:52:04AM -0500, [email protected] wrote:
>> >> >-----Original Message-----
>> >> >From: Thomas Dickey <[email protected]>
>> >> >Sent: November 16, 2025 10:39 AM
>> >> >To: [email protected]
>> >> >Cc: [email protected]; 'Ncurses Mailing List'
>> >> <[email protected]>
>> >> >Subject: Re: Contributions for HPE NonStop/Tandem
>> >> >
>> >> >On Sun, Nov 16, 2025 at 10:25:57AM -0500, [email protected]
>wrote:
>> >> >> Hi Thomas,
>> >> >>
>> >> >> I wonder what the best way would be to contribute changes to
>> >> >> support the HPE NonStop platform (formerly Tandem).
>> >> >>
>> >> >> The changes are all in the configure file relating to the intptr_t
>> >> >> definition. Prior to building ncurses, I run the following:
>> >> >>
>> >> >> sed "/#define intptr_t long/!{p;d};a #if defined (__TANDEM)" -i
>> >> >> configure sed "/#define intptr_t long/!{p;d};n;a # if ! defined
>> >> >> (__cplusplus)" -i configure sed "/#define intptr_t
>> >> >> long/!{p;d};n;n;a # define intptr_t long" -i configure sed
>> >> >> "/#define intptr_t long/!{p;d};n;n;n;a # endif" -i configure sed
>> >> >> "/#define intptr_t long/!{p;d};n;n;n;n;a #else" -i configure sed
>> >> >> "/#define intptr_t long/!{p;d};n;n;n;n;n;a # define intptr_t long"
>> >> >> -i configure sed "/#define intptr_t long/!{p;d};n;n;n;n;n;n;a
>> >> >> #endif" -i configure sed "/#define intptr_t long/d" -i configure
>> >> >
>> >> >That's changing this chunk
>> >> >
>> >> > cat >>confdefs.h <<EOF
>> >> > #define intptr_t long
>> >> > EOF
>> >> >
>> >> >to something like
>> >> >
>> >> > cat >>confdefs.h <<EOF
>> >> > #if defined (__TANDEM)
>> >> > # if ! defined (__cplusplus)
>> >> > #  define intptr_t long
>> >> > # endif
>> >> > #else
>> >> > # define intptr_t long
>> >> > #endif
>> >> > EOF
>> >> >
>> >> >But that would be used if there's something unexpected in the
>> >> compile-check:
>> >> >
>> >> > #line 22993 "configure"
>> >> > #include "confdefs.h"
>> >> > $ac_includes_default
>> >> > int
>> >> > main (void)
>> >> > {
>> >> > if ((intptr_t *) 0)
>> >> >   return 0;
>> >> > if (sizeof (intptr_t))
>> >> >   return 0;
>> >> >   ;
>> >> >   return 0;
>> >> > }
>> >> > _ACEOF
>> >> > rm -f "conftest.$ac_objext"
>> >> > if { (eval echo "$as_me:23008: \"$ac_compile\"") >&5
>> >> >
>> >> >or if the way it's used in the code doesn't have the #include's that
>> >> >were
>> >> needed in
>> >> >$ac_includes_default
>> >> >
>> >> > ac_includes_default="\
>> >> > #include <stdio.h>
>> >> > #if HAVE_SYS_TYPES_H
>> >> > # include <sys/types.h>
>> >> > #endif
>> >> > #if HAVE_SYS_STAT_H
>> >> > # include <sys/stat.h>
>> >> > #endif
>> >> > #if STDC_HEADERS
>> >> > # include <stdlib.h>
>> >> > # include <stddef.h>
>> >> > #else
>> >> > # if HAVE_STDLIB_H
>> >> > #  include <stdlib.h>
>> >> > # endif
>> >> > #endif
>> >> > #if HAVE_STRING_H
>> >> > # if !STDC_HEADERS && HAVE_MEMORY_H
>> >> > #  include <memory.h>
>> >> > # endif
>> >> > # include <string.h>
>> >> > #endif
>> >> > #if HAVE_STRINGS_H
>> >> > # include <strings.h>
>> >> > #endif
>> >> > #if HAVE_INTTYPES_H
>> >> > # include <inttypes.h>
>> >> > #else
>> >> > # if HAVE_STDINT_H
>> >> > #  include <stdint.h>
>> >> > # endif
>> >> > #endif
>> >> > #if HAVE_UNISTD_H
>> >> > # include <unistd.h>
>> >> > #endif"
>> >> >
>> >> >So... what did I miss in the configure script (or C code)?
>> >> >
>> >> >> This has been required for a long time.
>> >>
>> >> The issue is that intptr_t is different when building in c++ vs.
>> >> standard C on NonStop. There isn't anything I can do about that. It is
>> >> the missed C++ wrapper that counts here.
>> >>
>> >> What the code looks like, for NonStop is:
>> >>
>> >> cat >>confdefs.h <<EOF
>> >> #if defined (__TANDEM)
>> >> # if ! defined (__cplusplus)
>> >> #  define intptr_t long
>> >> # endif
>> >> #else
>> >> # define intptr_t lon
>> >> #endif
>> >> EOF
>> >>
>> >> That inhibits intptr_t, which is already defined in C++ headers on the
>> >> platform but not by the c99 compiler when not in C++.
>> >
>> >oh... then you're compiling ncurses with C++ ?
>> >
>> >I don't see where I might have used intptr_t in any of the public
>> interface:
>> >
>> >INSTALL:1328:       better choice would be intptr_t, which was not
available at
>> the time
>> >INSTALL:1676:          --with-tparm-arg=intptr_t
>> >NEWS:5843:  + build-fix for OpenBSD 4.9 to supply consistent intptr_t
>> declaration
>> >aclocal.m4:109:     cf_dft_tparm_arg=intptr_t
>> >configure:1769:     cf_dft_tparm_arg=intptr_t
>> >configure:22987:echo "$as_me:22987: checking for intptr_t" >&5
>> >configure:22988:echo $ECHO_N "checking for intptr_t... $ECHO_C" >&6
>> >configure:22999:if ((intptr_t *) 0) configure:23001:if (sizeof
(intptr_t))
>> >configure:23034:#define intptr_t long
>> configure.in:1871:AC_CHECK_TYPE(intptr_t,
>> >long)
>> >ncurses/curses.priv.h:142:# define CASTxPTR(n)    (unsigned
>> >long)(intptr_t)(void*)(n)
>> >ncurses/curses.priv.h:144:# define CASTxPTR(n)    (intptr_t)(n)
>> >ncurses/tinfo/lib_win32con.c:155:    intptr_t value =
_get_osfhandle(fd);
>> >package/mingw-ncurses.spec:77:      --with-tparm-arg=intptr_t \\\
>> >progs/toe.c:298:    if ((intptr_t) value == (intptr_t) (-1)) {
>> >test/test.priv.h:492:#define my_intptr_t    intptr_t
>>
>> It was a year ago when I did this because I was getting compile errors
for
>> internals. Removing the above code, here is the output, showing that C++
>> appears to be required. I have included the configure step and snipped
out
>> the non-error code:
>
>I see (partly):
>
>       A C++ compiler is needed in the configure script if you want to
>       be able to use the headers (such as curses.h) with a C++ compiler
>       later -- because curses and C++ both declare "bool".
>
>       The configure script tries to ensure that ncurses uses the same
>       type for "bool" (as it also does for the different C standards
>       as C's "bool" has evolved).
>
>       If you don't want to use it from C++, it's okay to disable that
>       feature in the configure script, as mentioned in INSTALL:
>
>           Use --without-cxx-binding to tell configure to not build the C++
bindings
>           and demo.
>
>That "c11" in the log looks to me like C 2011, which isn't going to be a
>C++ compiler.
>
>If you were using a C++ compiler for "CC", that would break a lot of the
>configure checks.

I found a decent workaround for this. Defining -D__NSK_OPTIONAL_TYPES__ in
CFLAGS
makes the intptr_t available when needed in both C++11 and C11 on NonStop.

Contribution unnecessary in this situation.

--Randall


Reply via email to