The guide "Using Singly Linked Lists" uses _aligned_malloc
to allocate the SLIST_HEADER structure before calling InitializeSListHead()
on it. Is it a requirement that the list header structure is placed on the heap? I mean, it's declared with DECLSPEC_ALIGN(16)
(on Win64), the compiler would place it on a required 16-byte boundary, won't it?
The giveaway here is the mix of libraries. The SLIST part comes from Windows itself (doesn't assume C/C++) while _aligned_malloc
comes from the MSVCRT. Since the SLIST code cannot even assume MSVCRT is used, it doesn't know where the memory came from.
So it doesn't matter by which means you (or the compiler) align the memory, or how your language calls a particular category of memory. (Your "heap" most likely isn't a Windows Heap in the HeapAlloc
sense of the word)