3 ms·
malloc is special in environments that aren't free-standing, the compiler can assume that the pointer that malloc returns doesn't alias any other at that point.
by cokernel_hacker 13y ago
malloc is special in environments that aren't free-standing, the compiler can assume that the pointer that malloc returns doesn't alias any other at that point.
- dllthomas 13y agoThough with most compilers, there are ways of making other functions similarly special.
- t1m 13y agoI am not familiar with 'free-standing', though, I think that malloc in most environments never returns the same pointer twice (an alias). Though I may misunderstand your point.
- cokernel_hacker 13y agoC++11 1.4 [intro.compliance]/p7 "A freestanding implementation is one in which execution may take place without the benefit of an operating system, and has an implementation-defined set of libraries that includes certain language-support libraries" [1] C11 4 [conformance]/p6 "A conforming freestanding implementation shall accept any strictly conforming program in which the use of the features specified in the library clause (clause 7) is confined to the contents of the standard headers <float.h>, <iso646.h>, <limits.h>, <stdalign.h>, <stdarg.h>, <stdbool.h>, <stddef.h>, <stdint.h>, and <stdnoreturn.h>." [2] [1] http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n324... [2] http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf