Test for valid ERL_NIF_TERM

Sverker Eriksson sverker.eriksson@REDACTED
Mon Sep 27 11:57:15 CEST 2021


No there is no ERL_NIF_TERM_UNINITIALISED in the erl_nif API.

There is one erts internal called THE_NON_VALUE, which is what is returned by enif_raise_exception and makes enif_is_exception return true.

So it would be possible to introduce, but I'm not sure how to best make it fit in with the existing "exception" value.

If you just want to do something quick and dirty use the value zero. But don't complain if that stops working at some time.

/Sverker, Erlang/OTP
________________________________
From: erlang-questions <erlang-questions-bounces@REDACTED> on behalf of Robert Harris <robert.harris@REDACTED>
Sent: Wednesday, September 22, 2021 12:50 PM
To: erlang-questions@REDACTED Questions <erlang-questions@REDACTED>
Subject: Test for valid ERL_NIF_TERM

Are any values of ERL_NIF_TERM reserved to mean "invalid"? I.e. is
there a blessed equivalent of

ERL_NIF_TERM optional = ERL_NIF_TERM_UNINITIALISED;
.
.
.
if (optional != ERL_NIF_TERM_UNINITIALISED)
do_something(optional)

?

Robert
Confidentiality Notice | This email and any included attachments may be privileged, confidential and/or otherwise protected from disclosure. Access to this email by anyone other than the intended recipient is unauthorized. If you believe you have received this email in error, please contact the sender immediately and delete all copies. If you are not the intended recipient, you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.



Disclaimer

The information contained in this communication from the sender is confidential. It is intended solely for use by the recipient and others authorized to receive it. If you are not the recipient, you are hereby notified that any disclosure, copying, distribution or taking action in relation of the contents of this information is strictly prohibited and may be unlawful.

This email has been scanned for viruses and malware, and may have been automatically archived by Mimecast, a leader in email security and cyber resilience. Mimecast integrates email defenses with brand protection, security awareness training, web security, compliance and other essential capabilities. Mimecast helps protect large and small organizations from malicious activity, human error and technology failure; and to lead the movement toward building a more resilient world. To find out more, visit our website.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20210927/f28b2767/attachment.htm>


More information about the erlang-questions mailing list