[CLN-list] CLN defines macro As in global space
Bruno Haible
bruno at clisp.org
Mon Oct 23 15:30:15 CEST 2023
Hi Sebastian,
> We, developers of the model checker Storm, are long-time users of CLN. Thanks for all your work.
> We recently got a bug message that boils down to a conflict between different libraries.
>
> In particular, CLN adds the Macro AS in include/cln/number.h in line 274. This macro is globally defined upon including CLN and uses conflicts, e.g., MLPACK.
> While we can work around this issue, we thought it may be possible to rename the macro to CL_AS or even _CL_AS.
This would be problematic, because the 'As' macro is a documented (and important)
functionality of CLN. For 'The', there is 'cln::the' as a template alternative,
but for 'As' we don't have an alternative 'cln::as' yet.
Is the problem really so big? In https://github.com/mlpack/mlpack the only uses
of the identifier 'As' are not in front of an opening parenthesis:
mlpack/src/mlpack/methods/lsh/lsh_search_impl.hpp:671: std::vector<bool> As = Ai;
mlpack/src/mlpack/methods/lsh/lsh_search_impl.hpp:674: if (PerturbationShift(As) && PerturbationValid(As))
mlpack/src/mlpack/methods/lsh/lsh_search_impl.hpp:676: perturbationSets.push_back(As); // add shifted set to sets
mlpack/src/mlpack/methods/lsh/lsh_search_impl.hpp:678: std::make_pair(PerturbationScore(As, scores),
therefore in fact I cannot see a conflict with mlpack at all.
I would therefore suggest the usual workaround:
- tweak the order of #includes,
- '#undef As' at appropriate places.
Bruno
More information about the CLN-list
mailing list