J
junky_fellow
The standard says that,
The pointer returned by malloc(), if the allocation
succeeds is suitably aligned so that it may be assigned to a
pointer to any type of object.
Since, the alignment cannot be done portably, is that mean
that malloc is implementation specific ? The malloc()
written for one implementation may not be work on other
implementations ?
Also, how does malloc() determine, which pointer type has the most
strict alignment storage restrictions ? Because it has to return
a pointer that would always be aligned to the pointer type that
has most strict alignment storage restriction.
The pointer returned by malloc(), if the allocation
succeeds is suitably aligned so that it may be assigned to a
pointer to any type of object.
Since, the alignment cannot be done portably, is that mean
that malloc is implementation specific ? The malloc()
written for one implementation may not be work on other
implementations ?
Also, how does malloc() determine, which pointer type has the most
strict alignment storage restrictions ? Because it has to return
a pointer that would always be aligned to the pointer type that
has most strict alignment storage restriction.