|
Message-ID: <Pine.BSM.4.64L.2404211547150.25471@herc.mirbsd.org> Date: Sun, 21 Apr 2024 15:50:31 +0000 (UTC) From: Thorsten Glaser <tg@...bsd.de> To: musl@...ts.openwall.com Subject: Re: Alignment attribute in headers Michael Forney dixit: >Something like > >#if __STDC_VERSION__ >= 201112L >/* use _Alignas */ >#elif defined(__cplusplus) && !defined(__GNUC__) >/* use alignas */ >#else >/* use __attribute__((__aligned__(N))) */ >#end Something I noticed recently while doing m68k alignment work: The C++ alignas is UB if the specified alignment is smaller than what the structure would normally have, so adding cautious alignments can explode in one’s face. ☹ Not only is this really stupid, but makes it not generally usable, too. GCC’s attribute, in contrast, (without __packed__) just gets ignored for those cases. I haven’t looked at the C11 one. bye, //mirabilos -- “It is inappropriate to require that a time represented as seconds since the Epoch precisely represent the number of seconds between the referenced time and the Epoch.” -- IEEE Std 1003.1b-1993 (POSIX) Section B.2.2.2
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.