[erlang-questions] strange definition of enif_get_uint64

Mikael Pettersson mikpelinux@REDACTED
Thu Aug 29 20:08:32 CEST 2019

On Thu, Aug 29, 2019 at 10:35 AM Caragea Silviu <silviu.cpp@REDACTED> wrote:
> But why not just using they definitions from stdint.h on platforms where this one exists ?

Presumably legacy from the times when stdint.h wasn't widely
available.  Also, in most cases it works fine to use equivalent (wrt
size and sign) but syntactically different types.

> Idea is that the way is right now creates lot of conversions warnings if using NIF in mix with other libs that respects the <stdint.h> standard. And I need to put lot of casts to avoid them

Presumably pointers or printf/scanf formats are involved, as e.g. a
64-bit long and a likewise 64-bit long long are fully
assignment-compatible, but pointers to them are not, and C compilers
like to warn when seeing "the wrong" printf/scanf format letter for an
argument even if they happen to match on the current target.

Yes, preference should be to use <stdint.h> and <inttypes.h> as far as
possible, but OTP's development cycles are limited.

More information about the erlang-questions mailing list