Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.std.c > #1362

Re: Structure Packing.

Path csiph.com!usenet.pasdenom.info!gegeweb.org!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail
From James Kuyper <jameskuyper@verizon.net>
Newsgroups comp.std.c
Subject Re: Structure Packing.
Date Thu, 07 Jun 2012 12:39:25 -0400
Organization A noiseless patient Spider
Lines 39
Message-ID <4FD0D93D.1000509@verizon.net> (permalink)
References <12b3df42-f6a0-4411-a5e5-136900f8255b@googlegroups.com> <lny5nzdhts.fsf@nuthaus.mib.org> <7b7e3dfb-047c-4f23-807b-1ba15e927d17@googlegroups.com> <lntxynd328.fsf@nuthaus.mib.org> <88bc5051-38fa-481d-81bb-8a7c81d187a6@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
Injection-Info mx04.eternal-september.org; posting-host="2P71cupDoazVVolqpw1jrw"; logging-data="8826"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/gATSb85TQXyK3udv4ibCHt4ffso6cAQU="
User-Agent Mozilla/5.0 (X11; Linux i686; rv:9.0) Gecko/20111220 Thunderbird/9.0
In-Reply-To <88bc5051-38fa-481d-81bb-8a7c81d187a6@googlegroups.com>
Cancel-Lock sha1:TpMNyzAzokooeoaT3XjmptoAG4Y=
Xref csiph.com comp.std.c:1362

Show key headers only | View raw


On 06/07/2012 10:47 AM, John Kearney wrote:
...
> Well its quiet normal for compilers to have arch specific
> optimizations, stepping specific even in some cases. Admittedly I can
> see how it would be problematic to do this on BE system and be spec
> conform, it is a feature I would like to see. there is so much
> senseless overuse of uint16_t and char for things like counters etc..
> where people really don't seem to understand the cost in code space
> and senseless expand operations. Its even worse when you consider in
> a lot of cases due to alignment at least an native int will be taken
> anyway. I mean unless its an array it prob wouldn't take more data
> space, it would save quiet a bit of code space, and it would execute
> quicker. :) win win win. Ok I've oversimplified a bit but hopefully
> you get my point. I looked into it recently arm and ppc both use an
> extra 4 bytes of code when reading an undersized int, to expand it to
> a full int, mips uses 2 bytes, and even x86 costs more due to type
> modifiers etc.

Before the final draft of C99 standard was finished, I anticipated that
people would behave that way. I argued for changing the name from
uint16_t to uint_exact16_t, and the name uint_fast16_t to uint16_t (and
similarly for the other sizes), so as to encourage the routine use of
the fast types, and to discourage unnecessary use of exact-sized types.
I didn't win many converts, and anyway, by the time I made the
suggestion it was already too late to make changes that big in the proposal.

...
> Now I did look into using uint16fast_t and uint16least_t but in my
> compilers and on my targets they seem to be mapped the same as
> uint_t. which frustrated me I don't get why a uint8fast_t
> uint16fast_t isn't mapped to a native uint even if it is 32bit. this
> is actually what I expected from these.

The implication of choosing the same type for uint16_t and uint_fast16_t
is that the person who made that choice believes
that uint16_t also happens to be the fastest supported unsigned type
with at least 16 bits. Your complaint implies that you disagree. Do you
have hard evidence to back up your opinion? If so, you should present it
to whoever provided <stdint.h>.

Back to comp.std.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Structure Packing. John Kearney <dethrophes@googlemail.com> - 2012-06-06 17:27 -0700
  Re: Structure Packing. James Kuyper <jameskuyper@verizon.net> - 2012-06-06 21:19 -0400
    Re: Structure Packing. Walter Banks <walter@bytecraft.com> - 2012-06-11 22:39 -0400
      Re: Structure Packing. Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-12 09:21 -0400
        Re: Structure Packing. Walter Banks <walter@bytecraft.com> - 2012-06-12 11:51 -0400
          Re: Structure Packing. Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2012-06-12 18:37 +0200
            Re: Structure Packing. Walter Banks <walter@bytecraft.com> - 2012-06-12 15:06 -0400
              Re: Structure Packing. Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-12 16:22 -0400
                Re: Structure Packing. Walter Banks <walter@bytecraft.com> - 2012-06-12 17:44 -0400
                Re: Structure Packing. Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2012-06-13 15:53 +0200
                Re: Structure Packing. Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2012-06-18 12:37 +0300
        Re: Structure Packing. Martin Shobe <martin.shobe@yahoo.com> - 2012-06-12 16:22 +0000
          Re: Structure Packing. Walter Banks <walter@bytecraft.com> - 2012-06-12 15:24 -0400
            Re: Structure Packing. Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-06-12 16:33 -0400
              Re: Structure Packing. Walter Banks <walter@bytecraft.com> - 2012-06-12 17:17 -0400
  Re: Structure Packing. Keith Thompson <kst-u@mib.org> - 2012-06-06 18:35 -0700
    Re: Structure Packing. John Kearney <dethrophes@googlemail.com> - 2012-06-06 21:58 -0700
      Re: Structure Packing. Keith Thompson <kst-u@mib.org> - 2012-06-06 23:54 -0700
        Re: Structure Packing. John Kearney <dethrophes@googlemail.com> - 2012-06-07 07:47 -0700
          Re: Structure Packing. James Kuyper <jameskuyper@verizon.net> - 2012-06-07 12:39 -0400
    Re: Structure Packing. jacob navia <jacob@spamsink.net> - 2012-06-07 11:14 +0200
      Re: Structure Packing. Keith Thompson <kst-u@mib.org> - 2012-06-07 09:46 -0700
        Re: Structure Packing. John Kearney <dethrophes@googlemail.com> - 2012-06-07 11:57 -0700

csiph-web