From: Mark Williamson Subject: Re: debugging frustration Date: Mon, 14 Feb 2005 16:38:15 +0000 Message-ID: <200502141638.15222.maw48@cl.cam.ac.uk> References: <6964b3969b0cbc632c2161cb16ad0e8b@fotango.com> <4210BDA9.5070901@codemonkey.ws> <20050214161419.GB2719@nsk.no-ip.org> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit In-Reply-To: <20050214161419.GB2719@nsk.no-ip.org> Content-Disposition: inline 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: xen-devel@lists.sourceforge.net Cc: Luciano Miguel Ferreira Rocha List-Id: xen-devel@lists.xenproject.org > if (ptr == null) > ; > else > *ptr = 2 > > The only problem is when the macro has some code (AFAIK). Using a "do {} while(0)" makes the compilation fail if you use the macro somewhere it wouldn't be valid when debugging enabled. Otherwise, you could end up developing with debugging turned off and not notice the macro is being misused until someone turns it on. Having a dummy statement helps catch this kind of error. Cheers, Mark ------------------------------------------------------- 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