From owner-freebsd-hackers Mon Feb 9 04:28:40 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id EAA21684 for hackers-outgoing; Mon, 9 Feb 1998 04:28:40 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from shrimp.dataplex.net (shrimp.dataplex.net [208.2.87.3]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id EAA21678 for ; Mon, 9 Feb 1998 04:28:36 -0800 (PST) (envelope-from rkw@dataplex.net) Received: from [208.2.87.4] (user4.dataplex.net [208.2.87.4]) by shrimp.dataplex.net (8.8.8/8.8.5) with ESMTP id GAA05234; Mon, 9 Feb 1998 06:28:31 -0600 (CST) X-Sender: rkw@mail.dataplex.net Message-Id: In-Reply-To: <19980209130707.03437@follo.net> References: ; from Richard Wackerbarth on Mon, Feb 09, 1998 at 05:49:52AM -0600 ; <19980209075127.63680@follo.net> <19980209091644.21614@follo.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Date: Mon, 9 Feb 1998 06:28:20 -0600 To: Eivind Eklund From: Richard Wackerbarth Subject: Re: DIAGNOSTICS and DEBUG LOGGING (was Re: cvs commit: src/sys/conf options) Cc: Hackers@FreeBSD.ORG Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG >On Mon, Feb 09, 1998 at 05:49:52AM -0600, Richard Wackerbarth wrote: >I'll try to send a description to the mailing-list, and then I'll >write up a new version if people seem interested. I need to get a >freeware version of it some day, anyway; re-writing it each time I >switch employers is getting a bit tedious... I've been there, too. >#ifdef _ASSERTS ># define ASSERT(X,Y) do {if (!(X)) panic Y;}while(0) >#else ># define ASSERT(X,Y) >#endif > >Notice the support for extra argument, the correct direction for the >assert (an assertion should always be true), and the bracketing to >force correct use of ";", making this a single C-statement after >pre-processing with _ASSERTS both defined and undefined. Yours is definitely a better description. The lines I wrote here were off the top of my head. They should be taken more for "flavour". My real macros are much more complicated because I also have provisions for logging, etc. Assert is just one case. In fact, I rarely look at the macros. They are neatly hidden away and "just work". Richard Wackerbarth To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe hackers" in the body of the message