mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Max Ruttenberg <mruttenberg@emutechnology.com>
To: musl@lists.openwall.com
Subject: Re: the size of the int type
Date: Mon, 18 Jan 2016 10:22:15 -0500	[thread overview]
Message-ID: <CAD+Cw=eu4F1SXo1WNBr+Pm9NngH5HUVYcT8G0BQ=k014vbXN-Q@mail.gmail.com> (raw)
In-Reply-To: <1452949769.30789.1.camel@inria.fr>

[-- Attachment #1: Type: text/plain, Size: 2177 bytes --]

All,

Thank you! You have convinced me that I should leave int as 32-bit, long
long as 64-bit, and long as the word size of the machine.

On Sat, Jan 16, 2016 at 8:09 AM, Jens Gustedt <jens.gustedt@inria.fr> wrote:

> Am Samstag, den 16.01.2016, 14:09 +0300 schrieb croco@openwall.com:
> > On Fri, Jan 15, 2016 at 09:11:25PM +0000, Josiah Worcester wrote:
> >
> > > You would do better to match the convention used on modern-day Unix
> > > systems, where int is 32-bit, long is the machine word size, and long
> long
> > > is 64-bit. If you do this everything should pretty much function as it
> > > expects, with regard to the standard C types' sizes.
> >
> > Let me second this.  Please note that in case you implement int as
> 64-bit,
> > then there will be either no 32-bit or no 16-bit integer type (at all),
> as
> > there's only the short which is in between char ant int; hence, well,
> there
> > will be a kind of problem with some typedefs from <stdint.h>: either
> > int16_t/uint16_t or int32_t/uint32_t will actually have a size different
> > from what the name suggests, so you'll run into a trouble with
> > reading/analysing data in binary formats.
>
> You certainly shouldn't do it like that. If you can't support
> [u]intXX_t for some XX, you shouldn't define these types. These are
> optional types in the C standard, but if they are defined they must
> have the exact width, and the intXX_t must have two's complement
> representation.
>
> Mandatory are only the [u]int_leastXX_t types for XX = 8, 16, 32 and
> 64. But as the name indicates, these don't have to have the exact
> width.
>
> In any case you should just stick to the standard ABI of your
> platform. Everything else would be opening a can of worms.
>
> Jens
>
>
> --
> :: INRIA Nancy Grand Est ::: Camus ::::::: ICube/ICPS :::
> :: ::::::::::::::: office Strasbourg : +33 368854536   ::
> :: :::::::::::::::::::::: gsm France : +33 651400183   ::
> :: ::::::::::::::: gsm international : +49 15737185122 ::
> :: http://icube-icps.unistra.fr/index.php/Jens_Gustedt ::
>
>
>
>


-- 
Max Ruttenberg,
Member of the Technical Staff
Emu *Technology*
1400 E Angela Blvd, Unit 101
South Bend, IN 46617

[-- Attachment #2: Type: text/html, Size: 3683 bytes --]

  reply	other threads:[~2016-01-18 15:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-15 21:01 Max Ruttenberg
2016-01-15 21:11 ` Josiah Worcester
2016-01-15 21:19   ` Max Ruttenberg
2016-01-16 11:09   ` croco
2016-01-16 13:09     ` Jens Gustedt
2016-01-18 15:22       ` Max Ruttenberg [this message]
2016-01-15 21:33 ` Rich Felker

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='CAD+Cw=eu4F1SXo1WNBr+Pm9NngH5HUVYcT8G0BQ=k014vbXN-Q@mail.gmail.com' \
    --to=mruttenberg@emutechnology.com \
    --cc=musl@lists.openwall.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).