In a message written on Thu, Mar 07, 2002 at 03:27:49PM -0500, Garance A Drosihn wrote:
> As to the wording, PHK suggested that the wording for this
> rule in style(9) be changed:
> - - -
> get rid of the word boolean, ie: change
> Do not use ! for tests unless it is a boolean, e.g. use
> to
At 2:16 AM -0500 3/7/02, Brian T.Schellenberger wrote:
>Maybe your brain has gotten used to it, but to us ordinary
>mortals, even us ordinary mortals who've been slogging C
>code for time periods that can be measured in decades
>(yikes!), it is very tempting to read
>
> if (!strcmp(a,b,l))
>
>as
On Thursday 07 March 2002 12:59 am, Poul-Henning Kamp wrote:
| In message <[EMAIL PROTECTED]>, "David O'Brien" writes:
| >Implies??? I thought I was quite explicit:
| >
| >to prevent is "if (!strcmp(a,b))" which when read is extremely wrong
| > of that is actually happening.
| >
| >! is prono
On Thu, Mar 07, 2002 at 07:14:49AM +0100, Poul-Henning Kamp wrote:
> Guys, strcmp() has been defined that way for almost 30 years, get
> used to it, and don't demand obfuscation of every other if() in
> the kernel to try to hide the fact...
We are not trying to hide anything. Style(9) says to do
In message <[EMAIL PROTECTED]>, "M. Warner Losh" writes
:
>: Well, that's my question. David's comment implies that it is not
>: good to do '!strcmp()', and I was wondering why it is not good...
>
> if (strcmp())
>
>is the problem with
>
> if (!strcmp())
>
>Which one is right? The fi
In message:
Garance A Drosihn <[EMAIL PROTECTED]> writes:
: At 7:49 PM +0100 3/6/02, Poul-Henning Kamp wrote:
: >Garance A Drosihn writes:
: > >In one message,
: >> At 12:52 AM -0800 3/6/02, David O'Brien wrote:
: >>>I don't think it is clar
In message <[EMAIL PROTECTED]>, "David O'Brien" writes:
>Implies??? I thought I was quite explicit:
>
>to prevent is "if (!strcmp(a,b))" which when read is extremely wrong of
>that is actually happening.
>
>! is pronounced "NOT". When read "if not string compare a with b then do X",
>is
Try this text instead:
In C, there is no boolean type but there are boolean
concepts, contexts that express or test yes/no, good/bad,
error/success, pointer initialized/not initialized, object
created/not created, and so on.
Where a conceptually boolean op
Poul-Henning Kamp <[EMAIL PROTECTED]> wrote:
>
>Right, and since the integer is well defined,
> if (!strcmp(a, b))
>is perfectly understandable so what is the problem ?
If that is ok, then why is
p = malloc(sizeof(*p));
if (!p)
return ENOMEM;
not ok, given
Poul-Henning Kamp <[EMAIL PROTECTED]> wrote:
>
>I had a discussion with Eric Allman about this very thing recently
>where he advocated "everything inside if, while, for and so on should
>be true booleans".
>
>Now, IFF the C language had a type called "boolean" that would make
>a lot of sense.
>
>U
On Wed, Mar 06, 2002 at 02:37:45PM -0500, Garance A Drosihn wrote:
> At 7:49 PM +0100 3/6/02, Poul-Henning Kamp wrote:
> >Garance A Drosihn writes:
> > >In one message,
> >> At 12:52 AM -0800 3/6/02, David O'Brien wrote:
> >>>I don't think it is clarifying a rule. I think it is in fact addin
At 7:49 PM +0100 3/6/02, Poul-Henning Kamp wrote:
>Garance A Drosihn writes:
> >In one message,
>> At 12:52 AM -0800 3/6/02, David O'Brien wrote:
>>>I don't think it is clarifying a rule. I think it is in fact adding
>>>a rule. You are extrapolating too much I think. All the rule is
>>>try
In message , Garance A Drosihn writes:
>In one message,
>At 12:52 AM -0800 3/6/02, David O'Brien wrote:
>>I don't think it is clarifying a rule. I think it is in fact adding
>>a rule. You are extrapolating too much I think. All the rule is
>>trying to
In one message,
At 12:52 AM -0800 3/6/02, David O'Brien wrote:
>I don't think it is clarifying a rule. I think it is in fact adding
>a rule. You are extrapolating too much I think. All the rule is
>trying to prevent is "if (!strcmp(a,b))" which when read is extremely
>wrong of that is actua
On Wed, Mar 06, 2002 at 11:37:42AM +0100, Poul-Henning Kamp wrote:
> Ahh, but here you hit one of my pet-peeves. I hate assignments inside
> conditionals. I prefer the above written as:
It does not matter. Style(9) does not [intentionally] avoid PHK's pet
peeves. It documents the style used b
In message <[EMAIL PROTECTED]>, "David O'Brien" cleopede:
>I don't think it is clarifying a rule. I think it is in fact adding a
>rule. You are extrapolating too much I think. All the rule is trying
>to prevent is "if (!strcmp(a,b))" which when read is extremely wrong of
>that is actually happe
Poul-Henning Kamp <[EMAIL PROTECTED]> types:
> Ahh, but here you hit one of my pet-peeves. I hate assignments inside
> conditionals. I prefer the above written as:
> Anyway, if you want it spelled out the way I would want it:
>
> 0. No assignments in if()
>
> 1. In conditions, pointers should
In message <[EMAIL PROTECTED]>, "Mike Meyer" writes:
>I'll grant that the change Paul suggested makes it clear - the
>programmer knows when the function is returning an int or not. But
>it's not clear that it achieves his intent. is
>
> char *p;
> if (p = somerandomfunction(with, args
David O'Brien <[EMAIL PROTECTED]> types:
> On Wed, Mar 06, 2002 at 01:19:31AM -0600, Mike Meyer wrote:
> > David O'Brien <[EMAIL PROTECTED]> types:
> > As the original author of the PR, I'll point out that this chagne does
> > *not* add rules. It clarifies the wording of a rule that's already
> >
In message <[EMAIL PROTECTED]>, "Mike Meyer" writes:
>Poul-Henning Kamp <[EMAIL PROTECTED]> types:
>> In message <[EMAIL PROTECTED]>, "Mike Meyer" writes:
>> I'm advocating that the rule focus on readability rather than trying
>> to enforce a type which doesn't exist.
>
>Excellent idea. Can you pr
On Tue, Mar 05, 2002 at 11:35:52PM -0700, M. Warner Losh wrote:
> : I was giving one. :-)
> : style(9) documents the practices of /sys. Thus we should not arbitaryly
> : add rules w/o them being backed up in code.
>
> I believe that sys/pccard, sys/dev/{pccard,pcic,pccbb,cardbus} tends
> to foll
On Wed, Mar 06, 2002 at 01:19:31AM -0600, Mike Meyer wrote:
> David O'Brien <[EMAIL PROTECTED]> types:
> > On Wed, Mar 06, 2002 at 02:08:07AM +0200, Giorgos Jeremiahs wrote:
> > I was giving one. :-)
> > style(9) documents the practices of /sys. Thus we should not arbitaryly
> > add rules w/o the
Poul-Henning Kamp <[EMAIL PROTECTED]> types:
> In message <[EMAIL PROTECTED]>, "Mike Meyer" writes:
> I'm advocating that the rule focus on readability rather than trying
> to enforce a type which doesn't exist.
Excellent idea. Can you provide verbiage and examples?
Thanx,
In message <[EMAIL PROTECTED]>, "Mike Meyer" writes:
>Poul-Henning Kamp <[EMAIL PROTECTED]> types:
>> In message <[EMAIL PROTECTED]>, "Mike Meyer" writes:
>> >David O'Brien <[EMAIL PROTECTED]> types:
>> >> On Wed, Mar 06, 2002 at 02:08:07AM +0200, Giorgos Keramidas wrote:
>> Now, IFF the C languag
Poul-Henning Kamp <[EMAIL PROTECTED]> types:
> In message <[EMAIL PROTECTED]>, "Mike Meyer" writes:
> >David O'Brien <[EMAIL PROTECTED]> types:
> >> On Wed, Mar 06, 2002 at 02:08:07AM +0200, Giorgos Keramidas wrote:
> Now, IFF the C language had a type called "boolean" that would make
> a lot of s
In message <[EMAIL PROTECTED]>, "Mike Meyer" writes:
>David O'Brien <[EMAIL PROTECTED]> types:
>> On Wed, Mar 06, 2002 at 02:08:07AM +0200, Giorgos Keramidas wrote:
>> I was giving one. :-)
>> style(9) documents the practices of /sys. Thus we should not arbitaryly
>> add rules w/o them being back
David O'Brien <[EMAIL PROTECTED]> types:
> On Wed, Mar 06, 2002 at 02:08:07AM +0200, Giorgos Keramidas wrote:
> I was giving one. :-)
> style(9) documents the practices of /sys. Thus we should not arbitaryly
> add rules w/o them being backed up in code.
As the original author of the PR, I'll poi
In message: <[EMAIL PROTECTED]>
"David O'Brien" <[EMAIL PROTECTED]> writes:
: On Wed, Mar 06, 2002 at 02:08:07AM +0200, Giorgos Keramidas wrote:
: > On 2002-03-05 15:58, David O'Brien wrote:
: > > On Tue, Mar 05, 2002 at 10:13:50PM +0200, Giorgos Keramidas wrote:
: > > > > -Don't use '
On Wed, Mar 06, 2002 at 02:08:07AM +0200, Giorgos Keramidas wrote:
> On 2002-03-05 15:58, David O'Brien wrote:
> > On Tue, Mar 05, 2002 at 10:13:50PM +0200, Giorgos Keramidas wrote:
> > > > -Don't use '!' for tests unless it's a boolean, e.g. use
> > > > +For tests, always compare the value to the
msg.pgp
Description: PGP message
On Tue, Mar 05, 2002 at 10:13:50PM +0200, Giorgos Keramidas wrote:
> > -Don't use '!' for tests unless it's a boolean, e.g. use
> > +For tests, always compare the value to the appropriate 0 instead of
> > +checking it directly, unless the value is a boolean.
> > +For pointers, use:
> > +.Bd -liter
On 2002-03-05 12:59, Julian Elischer wrote:
>
> On Tue, 5 Mar 2002, Giorgos Keramidas wrote:
> > >
> > > Read the man page to try and decide if you should write "if (x)" or
> > > if (x != 0).
> > >
> > > >Fix:
> > >
> > > Apply the attached page to the style(9) man page.
> [...]
>
> the one t
On Tue, 5 Mar 2002, Giorgos Keramidas wrote:
> >
> > Read the man page to try and decide if you should write "if (x)" or
> > if (x != 0).
> >
> > >Fix:
> >
> > Apply the attached page to the style(9) man page.
[...]
the one that I stop to think about is:
if (!(flags & FLAGSET))
or should t
The following is the largest part of the audit trail of PR docs/28555.
At the end of the audit trail, Dima Dorfman asked Mike Meyer to seek review
and comments from a wider audience than -doc. Since this documentation PR
has been open for quit some time now, I'm posting the patch the PR was
abou
34 matches
Mail list logo