Current-Users archive

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

Re: LLONG_MAX not available from c++



On Fri, 31 Mar 2023, Martin Husemann wrote:

On Fri, Mar 31, 2023 at 02:27:17PM -0000, Michael van Elst wrote:
c++ also doesn't define __STDC_VERSION__ nor _ISOC99_SOURCE.

It defines the former but not the latter:

> c++ -dM -E - < /dev/null | fgrep __STDC_VERSION__
#define __STDC_VERSION__ 201710L
> c++ -dM -E - < /dev/null | fgrep __ISO
>

(at least w/o special -std= options)


You have to create an empty file for `-E -dM' to work correctly:

$ > x.c
$ cc -E -dM x.c | fgrep STDC_VERSION
#define __STDC_VERSION__ 201710L
$ c++ -E -dM x.c | fgrep STDC_VERSION
$

Thomas, add `-D_NETBSD_SOURCE' to `MYCFLAGS'. That should work. As
Michael pointed out, a C++ compiler doesn't define __STDC_VERSION__
and the NetBSD limits.h doesn't test for `__cplusplus'.

-RVP


Home | Main Index | Thread Index | Old Index