<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
No there is no ERL_NIF_TERM_UNINITIALISED in the erl_nif API.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
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.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
So it would be possible to introduce, but I'm not sure how to best make it fit in with the existing "exception" value.<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
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.<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
/Sverker, Erlang/OTP<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> erlang-questions <erlang-questions-bounces@erlang.org> on behalf of Robert Harris <robert.harris@alertlogic.com><br>
<b>Sent:</b> Wednesday, September 22, 2021 12:50 PM<br>
<b>To:</b> erlang-questions@erlang.org Questions <erlang-questions@erlang.org><br>
<b>Subject:</b> Test for valid ERL_NIF_TERM</font>
<div> </div>
</div>
<style type="text/css">
<!--
.x_style1
        {font-family:"Times New Roman"}
-->
</style>
<div>Are any values of ERL_NIF_TERM reserved to mean "invalid"? I.e. is<br>
there a blessed equivalent of<br>
<br>
ERL_NIF_TERM optional = ERL_NIF_TERM_UNINITIALISED;<br>
.<br>
.<br>
.<br>
if (optional != ERL_NIF_TERM_UNINITIALISED)<br>
do_something(optional)<br>
<br>
?<br>
<br>
Robert<br>
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.<br>
<br>
<br>
<p style="font-family:Verdana; font-size:10pt; color:#666666"><b>Disclaimer</b></p>
<p style="font-family:Verdana; font-size:8pt; color:#666666">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.<br>
<br>
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.</p>
</div>
</body>
</html>