From: "H. Peter Anvin" <hpa@zytor.com>
To: linux-kernel@vger.kernel.org
Subject: Re: Advice on Unsigned Types
Date: 4 Sep 2001 18:00:19 -0700 [thread overview]
Message-ID: <9n3tf3$ffq$1@cesium.transmeta.com> (raw)
In-Reply-To: <3B8EF269.BF457C7F@home.com>
Followup to: <3B8EF269.BF457C7F@home.com>
By author: John Kacur <jkacur@home.com>
In newsgroup: linux.dev.kernel
>
> The advice the author give on Unsigned Types is:
> "Avoid unnecessary complexity by minimizing your use of unsigned types.
> Specifically, don't use an unsigned type to represent a quantity just
> because it will never be negative (e.g."age" or "national debt").
> Use a signed type like int and you won't have to worry about boundary
> cases in the detailed rules for promoting mixed types.
> Only use unsigned types for bitfields or binary masks. Use casts in
> expressions, to make all the operands signed or unsigned, so the
> compiler does not have to choose the result type."
>
So the author isn't talking about developing operating systems. In
operating systems it's almost the other way around -- signed is really
the exception.
-hpa
--
<hpa@transmeta.com> at work, <hpa@zytor.com> in private!
"Unix gives you enough rope to shoot yourself in the foot."
http://www.zytor.com/~hpa/puzzle.txt <amsp@zytor.com>
prev parent reply other threads:[~2001-09-05 1:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-08-31 2:11 Advice on Unsigned Types John Kacur
2001-09-05 1:00 ` H. Peter Anvin [this message]
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='9n3tf3$ffq$1@cesium.transmeta.com' \
--to=hpa@zytor.com \
--cc=linux-kernel@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.