1

I work on a large computational project that heavily use boost::mpl and boost:fusion on C++11.

Sometimes, in order to get some translation units to compile, I have to define the following BOOST macros:

FUSION_MAX_VECTOR_SIZE=40
FUSION_MAX_MAP_SIZE=40
BOOST_FUSION_DONT_USE_PREPROCESSED_FILES
BOOST_FUSION_INVOKE_MAX_ARITY=40
BOOST_RESULT_OF_NUM_ARGS=40
BOOST_MPL_LIMIT_VECTOR_SIZE=40
BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS=1

And yes, these definitions add significantly to the compile time. That's why I consider setting those variables on per-translation-unit basis.

Now the question arises, will translation units built with different settings of those variables be linkable with each other?

Someone in my organization suggests that, it would lead to the undefined behavior. My intuition tells me otherwise - after all, boost::mpl and boost::fusion are header-only, so anything that links, should be just a mangled plain C function, and if there are any incompatibilities, those will be necessary caught during the linking phase. But I may be wrong.

valiano
  • 16,433
  • 7
  • 64
  • 79
Adam Ryczkowski
  • 7,592
  • 13
  • 42
  • 68
  • Not familiar with boost fusion, but header only doesn't mean nothing bad ever happens. Consider `inline int foo() { return X; }`, with `X` defined differently for each TU. – Passer By Jul 26 '18 at 14:32
  • Does `FUSION_MAX_VECTOR_SIZE` even matter in C++11 mode? – Florian Weimer Jul 26 '18 at 20:53

0 Answers0