Xref: utzoo comp.lang.c:23189 comp.std.c:1935 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!attctc!kcdev!cpsolv!rhg From: rhg@cpsolv.UUCP (Richard H. Gumpertz) Newsgroups: comp.lang.c,comp.std.c Subject: Another malloc question Message-ID: <428@cpsolv.UUCP> Date: 23 Oct 89 20:35:44 GMT Reply-To: rhg@cpsolv.uucp (Richard H. Gumpertz) Organization: Computer Problem Solving, Leawood, Kansas Lines: 20 Another question about malloc: Suppose a system has one data type that must be aligned on a 32-byte boundary but all other objects can be aligned on a 2-byte boundary. Suppose further that the one data type having 32-byte alignment requirements has size X. Clearly no call to malloc requesting fewer than X bytes can really need 32-byte alignment; if there wre need of a 32-byte alignment then the size would have to be at least X. The current standard seems to prohibit malloc from special-casing requests for less than size X and returning only even alignment. Is this overkill in the language of the standard? Wouldn't it be better for the standard to only require malloc(N) to align the return value sufficiently for all objects of size <= N? This might let small requests pack more efficiently without breaking any programs. -- ========================================================================== | Richard H. Gumpertz rhg@cpsolv.UUCP -or- ...!uunet!amgraf!cpsolv!rhg | | Computer Problem Solving, 8905 Mohawk Lane, Leawood, Kansas 66206-1749 | ==========================================================================