C++ -malign-double compiler flag

前端 未结 3 590
粉色の甜心
粉色の甜心 2021-01-19 09:07

I need some help on compiler flags in c++. I\'m using a library that is a port to linux from windows, that has to be compiled with the -malign-double flag, \"for Win32 compa

3条回答
  •  悲&欢浪女
    2021-01-19 10:02

    It could be. If that code expects the stack to be aligned on entry, and your code doesn't ensure that, there is a problem. The same goes for heap allocated objects. If you pass pointers that should be aligned, but aren't, that's wrong too.

    At the same time, it could be that just one or two functions require some variables to be aligned, and it never was a problem after all. It would be nice if people are given the time required to understand the code they are responsible for but I guess that's not how it works in the real world.

提交回复
热议问题