On Fri, 13 May 2005, Martin Fuchs wrote:
Changelog use macros for platform dependent temporary allocations
[...]
+#define TMP_ALLOC(s) HeapAlloc(GetProcessHeap(), 0, s) +#define TMP_FREE(p) HeapFree(GetProcessHeap(), 0, p) +#else +#define TMP_ALLOC(s) alloca(s) +#define TMP_FREE(p) #endif
Why is this needed? Doesn't HeapAlloc work on any 'Win32' platform?
Why is this needed? Doesn't HeapAlloc work on any 'Win32' platform?
I want to avoid calling heap allocation functions. Using alloca() is slightly lighter.
Regards,
Martin
Doesn't HeapAlloc work on any 'Win32' platform?
I want to avoid calling heap allocation functions. Using alloca() is slightly lighter.
Please don't do that. It uglifies the code, and makes it less reliable. alloca() is lighter but it's on the stack, and I really doubt that yoy can measure the difference anyway.