Just noticed something interesting in the std.allocator source...

Gary Willoughby dev at nomad.so
Fri Oct 25 09:03:23 PDT 2013


Just noticed something interesting in the std.allocator source, 
right at the very bottom. An EOF and some code? Does the compiler 
stop at the EOF? If so why add code beyond that? Also 
version(none), eh?

https://github.com/andralex/phobos/blob/allocator/std/allocator.d#L4071

What's going on there?

...
__EOF__

version(none) struct TemplateAllocator
{
     enum alignment = platformAlignment;
     static size_t goodAllocSize(size_t s)
     {
     }
     void[] allocate(size_t)
     {
     }
     bool owns(void[])
     {
     }
     bool expand(ref void[] b, size_t)
     {
     }
     bool reallocate(ref void[] b, size_t)
     {
     }
     void deallocate(void[] b)
     {
     }
     void deallocateAll()
     {
     }
     void[] allocateAll()
     {
     }
     static shared TemplateAllocator it;
}


More information about the Digitalmars-d-learn mailing list