Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 04 Sep 2002 12:53:34 -0400 (EDT)
From:      John Baldwin <jhb@FreeBSD.org>
To:        Alfred Perlstein <bright@mu.org>
Cc:        arch@FreeBSD.ORG, Bruce Evans <bde@zeta.org.au>, Julian Elischer <julian@elischer.org>
Subject:   Re: Process/thread states.
Message-ID:  <XFMail.20020904125334.jhb@FreeBSD.org>
In-Reply-To: <20020904162711.GO73747@elvis.mu.org>

next in thread | previous in thread | raw e-mail | index | archive | help

On 04-Sep-2002 Alfred Perlstein wrote:
> * Julian Elischer <julian@elischer.org> [020904 09:20] wrote:
>> 
>> 
>> On Wed, 4 Sep 2002, Bruce Evans wrote:
>> 
>> > 
>> > I'd rather see (td->td_state == TDS_RUNNING).  Only very lay readers don't
>> > want to know anything about the details hidden by the macro.
>> 
>> Assembler would be the ultimate in that direction..
> 
> I have to agree with Julian on this one, it's really annoying when
> we have bugs just because someone forgot that not only is 
> foo->flags == SOMETHING, but that foo->enum is SOMETHINGELSE.
> 
> Since the macros will be pretty simple for the most part and the
> compiler is somewhat smart about constant folding let's do it the
> way that Julian suggested.

OK.  I GUESS NOW I NEED TO TURN ON MY CAPS LOCK AND USE MACROS EVERYTIME
I WANT TO CHECK A VARIABLE.

if (FOO_BAR_FLAG_IS_SET(f) {
        PRINT_OUT_INT(FOO_BAZ_FIELD(foo));
        PRINT_OUT_STRING(FOO_DESC_FIELD(FOO));
}

Yes, that is _much_ better than:

if (f->f_flag & FOO_BAR != 0)
        printf("%d%s", f->f_baz, f->f_desc);

-- 

John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.20020904125334.jhb>