All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ravid Baruch Naali <ravid@codefidence.com>
To: kernel-janitors@vger.kernel.org
Subject: Re: [KJ][PATCH]dev->mem_start default value (~0) test (final go)
Date: Tue, 24 Jul 2007 19:40:53 +0000	[thread overview]
Message-ID: <46A655C5.9020906@codefidence.com> (raw)
In-Reply-To: <46A5C2FE.6040602@codefidence.com>

Thanks for the comment,

But this 3 ways is one of the first lecture you get from you programming
teacher.

Where and what ever I developed adding an extra define for constant like
0, ~0, 0xffff etc.. always received the opposite comment "what's the
extra confusion for?"

So it's a matter of opinion but ask your self if you would define 0 any
where.

As for any arbitrary constant I totally agree with you.

I would love to here from any code maintainer what's the linux kernel
convention for the constant I mentioned above.

Håkon Løvdal wrote:
> On 24/07/07, Ravid Baruch Naali <ravid@codefidence.com> wrote:
>>
>> -       if (dev->mem_start)
>> +       /*dev->mem_start can also be ~0 which is the default*/
>> +       if (dev->mem_start && dev->mem_start != ~0)
>>                 dev->mem_end = dev->mem_start + EL2_MEMSIZE;
>>
> 
> In my oppinion there are three ways to write code:
> 
> 1. Write unreadable code
> 
>        if (answer = 42)
> 
> 2. Write unreadable code and try to comment it readable
> 
>        if (answer = 42)    // life, the universe and everything
> 
> 3. Write readable code
>        #define LIFE_THE_UNIVERSE_AND_EVERYTHING 42
>        ...
>        if (answer = LIFE_THE_UNIVERSE_AND_EVERYTHING)
> 
> 
> I think your patch would be better by not hardcoding ~0 with
> a corresponding comment.
> 
> BR Håkon Løvdal

_______________________________________________
REMINDER: this mailing list moved to vger.kernel.org and current one will be discontinued soon.
To resubscribe, send email to majordomo@vger.kernel.org with
&quot;subscribe kernel-janitors&quot; in message body and follow instructions.

Kernel-janitors mailing list
Kernel-janitors@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors

  parent reply	other threads:[~2007-07-24 19:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-24  9:14 [KJ][PATCH]dev->mem_start default value (~0) test Ravid Baruch Naali
2007-07-24 11:22 ` Ravid Baruch Naali
2007-07-24 12:37 ` [KJ][PATCH]dev->mem_start default value (~0) test (final go) Ravid Baruch Naali
2007-07-24 13:03 ` Håkon Løvdal
2007-07-24 13:32 ` WANG Cong
2007-07-24 17:54 ` Cripps
2007-07-24 19:40 ` Ravid Baruch Naali [this message]
2007-07-24 19:52 ` Ravid Baruch Naali
2007-07-25  0:30 ` Cripps

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=46A655C5.9020906@codefidence.com \
    --to=ravid@codefidence.com \
    --cc=kernel-janitors@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.