From: "Darren Jenkins\\" <darrenrjenkins@gmail.com>
To: kernel-janitors@vger.kernel.org
Subject: Re: [KJ][Patch] remove implicit sign bit in msp3400.h
Date: Sun, 19 Feb 2006 06:32:23 +0000 [thread overview]
Message-ID: <1140330744.7778.11.camel@localhost.localdomain> (raw)
In-Reply-To: <1139380004.9409.40.camel@localhost.localdomain>
[-- Attachment #1: Type: text/plain, Size: 1149 bytes --]
On Sat, 2006-02-18 at 15:33 +0300, Alexey Dobriyan wrote:
> On Thu, Feb 09, 2006 at 11:15:31PM +1100, Darren Jenkins" wrote:
> > Weird if you ask me. I'm pretty sure the C standard says they are
> > promoted to an int for calculations.
>
> It's very logical.
>
> int a:1;
>
> means 1 bit for sign (it's int) + >=1 bit for absolute value (it's int).
> So, >=2 bits you should somehow fit into 1 bit.
>
> int | unsigned int |
> -------------------+-------------------+---
> doesn't make sense | OK |:1
> OK | OK |:2
> OK | OK |:3
> ...
>
> I guess C standard says "undefined behaviour" or "implementation-defined".
Yep, that's how I understand it.
What I thought was weird was that the common coding style in the kernel
was to include the int, when it is implicit. Where the rest of the style
in the kernel seems to be to remove anything that is implicit.
Just an observation.
> BTW, someone could do
>
> int a:1;
> if (a < 0)
>
> so every time type is flipped, submitter should check every usage of "a".
>
I did not think of that kind of usage. Will check it in future.
Darren J.
[-- Attachment #2: Type: text/plain, Size: 168 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
next prev parent reply other threads:[~2006-02-19 6:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-08 6:26 [KJ][Patch] remove implicit sign bit in msp3400.h Darren Jenkins\
2006-02-08 7:02 ` [KJ][Patch] remove implicit sign bit in l64781.c Darren Jenkins\
2006-02-08 7:17 ` [KJ][Patch] remove implicit sign bit in isdnhdlc.h Darren Jenkins\
2006-02-08 15:32 ` [KJ][Patch] remove implicit sign bit in msp3400.h Randy.Dunlap
2006-02-09 12:15 ` Darren Jenkins\
2006-02-18 12:33 ` Alexey Dobriyan
2006-02-19 6:32 ` Darren Jenkins\ [this message]
2006-02-19 6:58 ` Matthew Wilcox
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=1140330744.7778.11.camel@localhost.localdomain \
--to=darrenrjenkins@gmail.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.