Is there a GCC keyword to allow structure-reordering?

后端 未结 4 1344
灰色年华
灰色年华 2020-11-30 08:54

I know why GCC doesn\'t re-order members of a structure by default, but I seldom write code that relies on the order of the structure, so is there some way I can flag my str

4条回答
  •  北海茫月
    2020-11-30 09:25

    There is no such option in GCC. And, I sure, it can not be introduced in any sensible fashion. About padding optimizations please look at this discussion.

    The only exception I know is hot/cold structure fields splitting, that can be done in some cases (still I am not sure, that GCC can do it even in profile-guided mode, I know ICC can). This feature is not under user control and is performed on call-graphs where conservativeness of such transformation over data-flow is provable.

提交回复
热议问题