C++ API: Vector arguments / error detection

Marc Nieper-Wißkirchen marc.nieper+gnu@gmail.com
Sun Jan 30 15:35:09 GMT 2022


This is about two unrelated issues regarding the C++ API:

(1) At the moment, a lot of API functions like new_function take non-const
referenced to vectors, e.g. std::vector <param> ¶ms;

Can we change this into const references?  This way, one can write

auto param1 = ctxt.new_param (...);
auto param2 = ctxt.new_param (...);
auto func = new_function (..., {param1, param2}, ...);

instead of the more complicated and less convenient

auto param1 = ...;
auto param2 = ...;
auto params = std::vector {param1, param2};
auto func = new_function (..., params, ...);

(2) When using gccjit::context::compile_to_file, how can I check whether
the compilation succeeded without errors or not? In libgccjit++.h no error
is checked and no exception thrown.

Thanks,

Marc


More information about the Jit mailing list