[erlang-questions] comparing of atoms in native code

Caragea Silviu <>
Thu Jan 19 12:51:35 CET 2017


hello let's suppose I have a static ERL_NIF_TERM which is equal with an
atom.

example:

ERL_NIF_TERM make_atom(ErlNifEnv* env, const char* name)
{
    ERL_NIF_TERM ret;

    if(enif_make_existing_atom(env, name, &ret, ERL_NIF_LATIN1))
        return ret;

    return enif_make_atom(env, name);
}

static ERL_NIF_TERM atomTrue =  make_atom(env, "true");


It is safe to compare this with other ERL_NIF_TERM values using = or !=
operators ?

Or I need to use enif_is_identical ?

Silviu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20170119/1213dceb/attachment.html>


More information about the erlang-questions mailing list