tbb function names conflict with MSVC debug heap macros

tbb function names conflict with MSVC debug heap macros

Ritratto di thevinn

The following .cpp does not compile under Visual Studio in a Debug build:

#define _CRTDBG_MAP_ALLOC
#include
#include

Reason: crtdbg.h provides macros for malloc() and free() that track the file and line number of allocations when linking with the Debug heap (Multithreaded Debug, or Multithreaded Debug DLL). Certain TBB classes have member functions with the same name as the standard C library functions. For example:

class allocate_continuation_proxy { void free(); }

Workaround: undefine free before including certain tbb headers when using the MSVC Debug Heap.

A better solution would be to rename free() in all tbb classes (perhaps "deallocate"?).

1 contenuto / 0 nuovi
Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione