PlCompound (C++) with zero arguments

Dear list,

I am playing around with the c++ library. Swipl allows for compound terms with zero arguments, see,
e.g. compound_name_arity with arity 0, so I was wondering if I can create compounds without arguments from C++. But the code below produces an atom:

#include "SWI-cpp.h"
#include <iostream>

int main(int argc, char** argv)
{
    PlEngine e(argc, argv) ;

    PlTerm pred = PlCompound("noargs", PlTermv(0)) ;
    PlQuery q("atom", pred) ;
    if(q.next_solution())
        std::cout << "atom" << std::endl ;
    return 0 ;
}

Is this a bug or a feature? The thing is: I can easily create an atom with PlTerm(“noargs”), so it would actually make sense to create a compound with the above code.

Best wishes,

Matthias

Ah, I see. It would be necessary to check current_predicate with compound_name_arguments to see if zero-argument compounds are supported by the dialect.

My workaround is something like PL_new_functor(PL_new_atom("noargs"), 0) that also works in C++.