public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kyle Moffett <mrmacman_g4@mac.com>
To: Renate Meijer <kleuske@xs4all.nl>
Cc: Grzegorz Kulewski <kangur@polcom.net>,
	Adrian Bunk <bunk@stusta.de>,
	Al Viro <viro@parcelfarce.linux.theplanet.co.uk>,
	linux-kernel@vger.kernel.org, Andreas Schwab <schwab@suse.de>,
	Kenneth Johansson <ken@kenjo.org>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	linux-os@analogic.com, Dag Arne Osvik <da@osvik.no>
Subject: Re: Use of C99 int types
Date: Tue, 5 Apr 2005 07:27:49 -0400	[thread overview]
Message-ID: <a2a171644af3ab214c5bc612eecc9167@mac.com> (raw)
In-Reply-To: <d5803044b1c7dcc631eda71863d44fa2@xs4all.nl>

On Apr 05, 2005, at 05:23, Renate Meijer wrote:
>> uint8/16/32/64, on the other hand, are specific bit-sizes, which
>> may not be as fast or correct as a simple size_t.
>
> Using specific widths may yield benefits on one platform, whilst
> proving a real bottleneck when porting something to another. A
> potential of problems easily avoided by using plain-vanilla
> integers.

The point of specific-width integers is to preserve a specific
binary format, such as a filesystem on-disk data structure, or a
kernel-userspace ABI, etc.  If you just need a number, use a
different type.

> Strictly speaking, a definition starting with a double
> underscore is reserved for use by the compiler and associated
> libs

Well, _strictly_speaking_, it's "implementation defined", where the
"implementation" includes the kernel (due to the syscall interface).

> this such a declaration would invade implementation namespace.
> The compilers implementation, that is.

But the C library is implicitly dependent on the kernel headers for
a wide variety of datatypes.

> In this case, the boundary is a bit vague, i see that, since a lot
> of header definitions also reside in the /usr/include hierarchy.

Some of which are produced by kernel sources: /usr/include/linux,
/usr/include/asm, etc.

> I think it would be usefull to at least *agree* on a standard type
> for 8/16/32/64-bit integer types. What I see now as a result of
> grepping for 'uint32' is a lot more confusing than stdint.h

Well, Linus has supported that there is no standard, except where
ABI is concerned, there we must use __u32 so that it does not clash
with libc or user programs.

> Especially the types with leading underscores look cool, but in
> reality may cause a conflict with compiler internals and should only
> be used when defining compiler libraries.

It's "implementation" (kernel+libc+gcc) defined.  It just means that
gcc, the kernel, and libc have to be much more careful not to tread
on each others toes.

> The '__' have explicitly been put in by ISO in order to avoid
> conflicts between user-code and the standard libraries,

The "standard libraries" includes the syscall interface here.  If
the kernel types could not be prefixed with __, then what _should_
we prefix them with?

> Furthermore, I think it's wise to convince the community that if
> not needed, integers should not be specified by any specific width.

That doesn't work for an ABI.  If you switch compilers (or from 32-bit
to 64-bit like from x86 to x86-64, you _must_ be able to specify
certain widths for all the ABI numbers to preserve compatibility.

Cheers,
Kyle Moffett

-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCM/CS/IT/U d- s++: a18 C++++>$ UB/L/X/*++++(+)>$ P+++(++++)>$
L++++(+++) E W++(+) N+++(++) o? K? w--- O? M++ V? PS+() PE+(-) Y+
PGP+++ t+(+++) 5 X R? tv-(--) b++++(++) DI+ D+ G e->++++$ h!*()>++$ r  
!y?(-)
------END GEEK CODE BLOCK------



  reply	other threads:[~2005-04-05 11:28 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-03 11:55 Use of C99 int types Dag Arne Osvik
2005-04-03 12:05 ` Stephen Rothwell
2005-04-03 12:30   ` Dag Arne Osvik
2005-04-03 13:27     ` Andreas Schwab
2005-04-03 22:48       ` Dag Arne Osvik
2005-04-03 23:05         ` Al Viro
2005-04-03 23:17         ` Grzegorz Kulewski
2005-04-03 23:20           ` Dag Arne Osvik
2005-04-04  0:05         ` Adrian Bunk
2005-04-03 18:13     ` Al Viro
2005-04-03 23:03       ` Dag Arne Osvik
2005-04-04  3:08         ` Herbert Xu
2005-04-04  8:42           ` Dag Arne Osvik
2005-04-03 19:23     ` Renate Meijer
2005-04-03 20:25       ` Kenneth Johansson
2005-04-03 22:08         ` Kyle Moffett
2005-04-04 10:05           ` Renate Meijer
2005-04-04 10:50             ` Dag Arne Osvik
2005-04-04 20:30               ` Renate Meijer
2005-04-04 20:57                 ` Al Viro
2005-04-04 21:25                   ` Richard B. Johnson
2005-04-04 21:49                     ` Kyle Moffett
2005-04-05  9:23                       ` Renate Meijer
2005-04-05 11:27                         ` Kyle Moffett [this message]
     [not found]                           ` <09142f748cc6ad2bf4fffab7a5519226@xs4all.nl>
2005-04-05 22:11                             ` Kyle Moffett
     [not found]                               ` <eb65bccddde63541ae4b7b2d6c4c32d3@xs4all.nl>
2005-04-06 21:11                                 ` Kyle Moffett
2005-04-07 11:28                                   ` Renate Meijer
2005-04-05 12:18                       ` Richard B. Johnson
2005-04-05 21:47                         ` Kyle Moffett
2005-04-05  8:49                   ` Renate Meijer

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=a2a171644af3ab214c5bc612eecc9167@mac.com \
    --to=mrmacman_g4@mac.com \
    --cc=bunk@stusta.de \
    --cc=da@osvik.no \
    --cc=kangur@polcom.net \
    --cc=ken@kenjo.org \
    --cc=kleuske@xs4all.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-os@analogic.com \
    --cc=schwab@suse.de \
    --cc=sfr@canb.auug.org.au \
    --cc=viro@parcelfarce.linux.theplanet.co.uk \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox