Alignment of `complex double`

2025-01-06 Thread M Chhapgar via Gcc
Hello, I am learning about memory alignment and noticed that on my x86-64 machine with GCC 14, a `complex double` has a size of 16 bytes, but an alignment of only 8 bytes. I am curious as to why this is. Doesn't it run the risk of ending up with a `complex double` that straddles cache lines? Tha

Re: Alignment of `complex double`

2025-01-06 Thread Jonathan Wakely via Gcc
N.B. your question belongs on the gcc-help list, or a general C programming forum. This mailing list is for discussing development of GCC, and the alignment is decided by the platform ABI not by GCC, so the question doesn't belong here. On Tue, 7 Jan 2025, 07:42 Jonathan Wakely, wrote: > > > On

Re: Alignment of `complex double`

2025-01-06 Thread Jonathan Wakely via Gcc
On Tue, 7 Jan 2025, 03:09 M Chhapgar via Gcc, wrote: > Hello, > > I am learning about memory alignment and noticed that on my x86-64 machine > with GCC 14, a `complex double` has a size of 16 bytes, but an alignment of > only 8 bytes. I am curious as to why this is. Because it's roughly equival