Defect Report #075
Submission Date: 03 Dec 93
Submittor: WG14
Source: Clive Feather
Question
Item 12 - alignment of allocated memory
Is a piece of memory allocated by malloc required to be aligned
suitably for any type, or only for those types that will fit into
the space? For example, following the assignment:
void *vp = malloc (1);
is it required that (void *)(int *)vp compare equal to vp
(assuming that sizeof(int) > 1), or is it permissible for vp
to be a value not suitably aligned to point to an int?
Response
Subclause 7.10.3 requires allocated memory to be suitably aligned
for any type, so they must compare equal.
Previous Defect Report
< - >
Next Defect Report