Slacker News Slacker News logo featuring a lazy sloth with a folded newspaper hat
  • top
  • new
  • show
  • ask
  • jobs
Library

Comment by stilley2

7 hours ago

Does that mean that if I have a struct with #pragma pack(push, 1) I can't use pointers to any members that don't happen to be aligned?

2 comments

stilley2

Reply

saagarjha  6 hours ago

This is a non-standard extension, so your compiler may provide stronger guarantees.

  • AlotOfReading  2 minutes ago

    In practice, both GCC and Clang consider pointers to these unaligned members to be UB and will flag them in UBSAN.

Slacker News

Product

  • API Reference
  • Hacker News RSS
  • Source on GitHub

Community

  • Support Ukraine
  • Equal Justice Initiative
  • GiveWell Charities