Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.c    |    Meh, in C you gotta define EVERYTHING    |    243,242 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 243,027 of 243,242    |
|    James Kuyper to David Brown    |
|    Re: UB or not UB? was: On Undefined Beha    |
|    15 Jan 26 06:16:35    |
      From: jameskuyper@alumni.caltech.edu              On 2026-01-15 05:45, David Brown wrote:       > On 14/01/2026 23:43, Keith Thompson wrote:       ...       >> sizeof (int) == 3 and alignof (int) == 4 is not possible. Each type's       >> size is a multiple of its alignment. There is no padding between array       >> elements.       >>       >       > I have not, as yet, found a justification for those statements in the       > standards. But I'll keep looking!       They follow from a couple of facts:       Each element in an array of type T must be correctly aligned for an       object of type T.       No space is allowed between the elements of an array. Note, in       particular, that this implies that if a type uses only 3 bytes, but has       an alignment requirement of 2, it must be padded to a length of 4 bytes,       and sizeof(T) must reflect that size, and not the number of bytes that       the type actually uses.              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca