dart icon indicating copy to clipboard operation
dart copied to clipboard

ABI that depends on C++ standard of downstream compilation unit in latest master?

Open traversaro opened this issue 5 years ago • 0 comments

By inspecting the DART source code, I noticed that the dart::common::optional class introduced in https://github.com/dartsim/dart/pull/1416 changes its ABI depending on the compilation flags of the compilation unit in which it is compiled. This may mean that one compilation unit creates a function that takes a dart::common::optional class with C++14, and another compilation unit uses this function in C++17, leading to a runtime error.

This kind of practice are allowed in some libraries (abseil, for example) that are meant to be compiled in enviroments where all the source code are compiled with exactly the same compilation option, but that is typically not the case for projects like DART that are used from binary packages compiled for Linux distributions.

Bug Report

  • [x] I checked the documentation and the forum but found no answer.
  • [x] I checked to make sure that this issue has not already been filed.

Environment

Select the following information.

  • DART version: master
  • OS name and version name(or number): any
  • Compiler name and version number: any

Expected Behavior

I would expect that, once configured and compiled, the ABI of the struct and classes present in DART headers would not change based on the compilation option of downstream projects.

Current Behavior

I did not any extensive test, but by inspection of the dart::common::optional class it seems that its ABI changes depending on the compilation option of downstream projects.

traversaro avatar Sep 19 '20 11:09 traversaro