[cfarm-users] What are people testing 32-bit builds on?
Paul Eggert
eggert at cs.ucla.edu
Fri May 15 17:01:59 CEST 2026
On 2026-05-15 07:22, Peter Gutmann via cfarm-users wrote:
> the standards and many
> environments make it impossible to find out what time_t actually is without
> building an executable and running it
You can find out merely by compiling a single module with -S and seeing
whether the compilation succeeds. You needn't build or run an
executable, so this approach works when cross-compiling. I do this sort
of thing all the time when using Autoconf. For example:
/* This compiles if time_t is signed. */
static_assert ((time_t) -1 < 0);
/* This compiles if time_t is Y2038-safe. */
static_assert (0 < (time_t) 0x80000000);
If you can't assume C23 or C++17 there are simple alternatives to
static_assert.
If you can't use Autoconf or anything like it, you can put tests like
"if ((time_t) -1 < 0) ..." in the source code; the test will be
optimized away so there's no runtime cost. Admittedly this can be less
convenient than an #ifdef, which is why I so often resort to Autoconf.
More information about the cfarm-users
mailing list