|
Boost Users : |
Subject: Re: [Boost-users] Boost::Process doesn't work with #define new (boost 1.69)
From: Gavin Lambert (boost_at_[hidden])
Date: 2019-02-12 05:16:56
On 12/02/2019 17:52, Vivek Subramanian wrote:
> Well, okay, but Win32 code doesn #undef new at the start, and Microsoft
> themselves say to #define new for using CRT!
>
> https://docs.microsoft.com/en-us/visualstudio/debugger/finding-memory-leaks-using-the-crt-library?view=vs-2017
Actually, no, they don't -- at least not on that page. (In fact it
specifically un-recommends that.)
The technique shown there is to define a DBG_NEW macro. You then
replace "new" with "DBG_NEW" whenever it appears in your application
code. Hopefully this included the source of the leak.
(You're doing this manually or via find/replace, not by #define new
DBG_NEW.)
It is true that in the past (and with MFC) they did recommend redefining
new, but that has caveats. To minimise problems you were always
supposed to do it only after all #includes, as I said in my other reply.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net