C99には
The pointer returned if the allocation succeeds is suitably aligned
so that it may be assigned to a pointer to any type of object and
then used to access such an object or an array of such objects
in the space allocated (until the space is explicitly deallocated).
とあるので、どんなオブジェクトでもその場所に置けることは保証されている。
ただ、アラインメントがずれてるとアクセスできるけど遅くなるとかいう
変態環境でどうなるかとかは規定されていない。
(ふつうの実装ならまともにアラインメントされていると思うが)
これをどうしても合法的に確実にアラインメントしたい人向けなのが、aligned_alloc()。
探検
C言語なら俺に聞け 146
■ このスレッドは過去ログ倉庫に格納されています
437デフォルトの名無しさん (JP 0H8f-J6FL)
2018/07/26(木) 17:03:12.87ID:0PbkpRUpH■ このスレッドは過去ログ倉庫に格納されています
