From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Subject: Re: debugging frustration Date: Mon, 14 Feb 2005 10:41:25 -0600 Message-ID: <4210D4B5.10504@codemonkey.ws> References: <6964b3969b0cbc632c2161cb16ad0e8b@fotango.com> <200502141424.38935.maw48@cl.cam.ac.uk> <4210BDA9.5070901@codemonkey.ws> <20050214161419.GB2719@nsk.no-ip.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20050214161419.GB2719@nsk.no-ip.org> Sender: xen-devel-admin@lists.sourceforge.net Errors-To: xen-devel-admin@lists.sourceforge.net List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , List-Archive: To: Luciano Miguel Ferreira Rocha Cc: xen-devel@lists.sourceforge.net List-Id: xen-devel@lists.xenproject.org Luciano Miguel Ferreira Rocha wrote: >Yes, but an empty macro results in the same thing as a do {} while (0) > > a = b debug_printf("Message"); compiles cleanly if DEBUG is #define'd as '' At the end of the day, we're dealing with a very imperfect system (cpp). My philosophy on debug() macro's is that they should always map 1-1 to a real function and simply provide that function with __LINE__, __FUNCTION__, and __FILE__. If you're really concerned about performance, you can #ifdef DEBUG the body of the function and most compilers will correctly do nothing for those calls. If it's any consolation, the next submission of VM-Tools will have a set of logging functions. I can certainly submit patches to xcs and friends to use these functions.. Regards, >if (ptr == null) > ; >else > *ptr = 2 > >The only problem is when the macro has some code (AFAIK). > > -- Anthony Liguori anthony@codemonkey.ws ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click