Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAD+Cw=eu4F1SXo1WNBr+Pm9NngH5HUVYcT8G0BQ=k014vbXN-Q@mail.gmail.com>
Date: Mon, 18 Jan 2016 10:22:15 -0500
From: Max Ruttenberg <mruttenberg@...technology.com>
To: musl@...ts.openwall.com
Subject: Re: the size of the int type

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@...ia.fr> wrote:

> Am Samstag, den 16.01.2016, 14:09 +0300 schrieb croco@...nwall.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

Content of type "text/html" skipped

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.