Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#pragma pack(n) 应该强调是编译器扩展 #110

Open
Mq-b opened this issue Oct 13, 2023 · 2 comments
Open

#pragma pack(n) 应该强调是编译器扩展 #110

Mq-b opened this issue Oct 13, 2023 · 2 comments

Comments

@Mq-b
Copy link

Mq-b commented Oct 13, 2023

它并非标准的,一般情况下不该去使用它。
可使用标准的 alignasalignof 运算符。

@frederick-vs-ja
Copy link

虽然但是, #pragma pack(n)alignas 的功能不同。

对于需要更改对齐的情况,相对于原生对齐 #pragma pack 只会改小对齐,而 alignas 只会改大对齐。

@Mq-b
Copy link
Author

Mq-b commented Oct 18, 2023

的确如此。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants