[squeak-dev] Re: becomeForward: alternative

Benjamin Pollack benjamin.pollack at gmail.com
Fri Sep 19 14:32:38 UTC 2008


On Fri, Sep 19, 2008 at 3:36 AM, Paolo Bonzini <bonzini at gnu.org> wrote:

>
> >         object_image->image.private = options & LINK_OPTION_PRIVATE) ==
> > LINK_OPTION_PRIVATE;
>
> Couldn't help it: if LINK_OPTION_PRIVATE is a single bit,
>
>  object_image->image.private = (options & LINK_OPTION_PRIVATE) != 0;
>

You can do better than that. Even if you really need to set image.private to
TRUE or FALSE explicitly, you can just do

object_image->image.private = !!(options & LINK_OPTION_PRIVATE)

and if you don't, you can drop the !!.

I'd really rather just not write C though.

--Benjamin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20080919/37bed243/attachment.htm


More information about the Squeak-dev mailing list