Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualfastcall22

Posted 10 September 2012 - 01:56 PM

Strange. Maybe here comes this? What is beeing used for?:

I've seen this code:
#define new new (_FILE_, _LINE_, _LINE);

Any suggestions?


This macro tags all of your "new" with additional information -- the file and the line wherein the allocation was made. (Though, it should be new (_NORMAL_BLOCK, __FILE__, __LINE__).) If you haven't already, take a look at the documentation on MSDN on the subject. It is also important to note that a #define in one header file isn't neccessarily applied everywhere else to your project. Remember, the contents of a header file are dumped into the source file that includes it and each source file is compiled separately. If you have one source file that includes a set of headers that eventually defines the new macro and another source file that does not, then allocations with new in the first file will get logged with the additional information and the other source will not.

#1fastcall22

Posted 10 September 2012 - 01:56 PM

Strange. Maybe here comes this? What is beeing used for?:

I've seen this code:
#define new new (_FILE_, _LINE_, _LINE);

Any suggestions?


This macro tags all of your "new" with additional information -- the file and the line wherein the allocation was made. (Though, it should be new (_NORMAL_BLOCK, __FILE__, __LINE__.) If you haven't already, take a look at the documentation on MSDN on the subject. It is also important to note that a #define in one header file isn't neccessarily applied everywhere else to your project. Remember, the contents of a header file are dumped into the source file that includes it and each source file is compiled separately. If you have one source file that includes a set of headers that eventually defines the new macro and another source file that does not, then allocations with new in the first file will get logged with the additional information and the other source will not.

PARTNERS