Re:How fast can you allocate a large block of memory in C++?
by SamReidHughes on Thursday January 16, 2020 @03:37AM
(#22062677)
I don't think that's possible, and in that case the std::function wouldn't work either.
[ Parent
| on HN ]
Re:How fast can you allocate a large block of memory in C++?
by gurkendoktor on Thursday January 16, 2020 @09:09AM
(#22064605)
I was thinking about calling conventions because std::free can use extern "C", but the function pointer declaration in C++ code points to an extern "C++" function, and the standard says these are two distinctive types. Are they guaranteed to be compatible - since they're only linkage specifiers, not calling conventions? I'm not sure.
std::function would still work in this case because pointers to C functions have a normal operator().
Re:How fast can you allocate a large block of memory in C++?
by SamReidHughes on Thursday January 16, 2020 @09:45AM
(#22064942)
Oh, right, it would work. Anyway, it looks like compilers have a known bug and they’re supposed to treat the types as incompatible.