Is it safe to link gcc 6, gcc 7, and gcc 8 objects?

前端 未结 2 537
梦如初夏
梦如初夏 2021-02-01 06:29

Is it safe to link C++17, C++14, and C++11 objects asks about linking objects compiled with different language standards, and Jonathan Wakely\'s excellent answer on that questio

2条回答
  •  悲&欢浪女
    2021-02-01 06:54

    Most of them alter mangling in minor ways, which could cause some undefined references while linking, or just some code bloat due to identical source code producing two equivalent symbols with different names, so won't be merged by the linker.

    the calling convention change for empty class types in 12 might?

    Yes, definitely. If you have non-final parameters that are empty types then that affects the ABI for the function, and differences can lead to undefined behaviour (in practice, accessing junk on the stack, or parameters getting the wrong values).

提交回复
热议问题