On Sun, Dec 03, 2023 at 11:03:30AM +0100, Bruno Haible wrote: > There is no guarantee, but the malloc() result has an alignment of at least 4 > on all of today's platforms. [1]
It may be legitimate to have such assumptions. But it is likewise legitimate that compilers and the associated libraries adhere strictly to the standard without accommodating such assumptions. You will have then to possibly live with annoying warnings and odd behaviours. Here is a classical example where common assumptions about integer arithmetic led to trouble when a newer version of gcc changed the game in a standard-conforming way: https://bugzilla.redhat.com/show_bug.cgi?id=175462 In case of malloc the game could be changed through LD_PRELOAD which is also perfectly legitimate as long as the replacement conforms to § 7.24.3. Andreas. -- Dr. Andreas F. Borchert, Institut für Numerische Mathematik, Universität Ulm Helmholtzstr. 20, 89081 Ulm, Raumnummer: 1.23, Telefon: +49 7315023572
smime.p7s
Description: S/MIME cryptographic signature