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


Groups > comp.lang.c > #10384

Re: datatype for bit flags

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.glorb.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date Sat, 17 Sep 2011 01:35:23 -0500
Message-ID <4E743FAD.3203@mindspring.com> (permalink)
Date Sat, 17 Sep 2011 02:35:25 -0400
From pete <pfiland@mindspring.com>
Reply-To pfiland@mindspring.com
Organization PF
X-Mailer Mozilla 3.04Gold (WinNT; I)
MIME-Version 1.0
Newsgroups comp.lang.c, comp.lang.c++
Subject Re: datatype for bit flags
References <j4s877$2a0$1@dont-email.me> <87k4994fkd.fsf@bazspaz.fatphil.org> <930e767b-26f0-4123-836d-64dac1f47cfb@d2g2000vbk.googlegroups.com> <EtPcq.16451$9w.7154@newsfe18.iad> <4E73CF44.619F@mindspring.com> <lny5xo6pes.fsf@nuthaus.mib.org>
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
Lines 32
X-Usenet-Provider http://www.giganews.com
NNTP-Posting-Host 4.154.216.217
X-Trace sv3-7n2Wq7ctcm1yJxMwpuhNQUxQLSjccJxf7V8mAF32oQAc6KDxJbeiXYJ2CSxMXCcFPfj5RuPfIS6nhni!3z+3mgYNvl5L1EI8ls0vGuIUwc0ZOQINiAFRA6QkPt0HAd71Pchao7VxUgVY/4Z+B747gLePkWLY!I4ltG5D6yPE=
X-Abuse-and-DMCA-Info Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info Otherwise we will be unable to process your complaint properly
X-Postfilter 1.3.40
X-Original-Bytes 2240
Xref x330-a1.tempe.blueboxinc.net comp.lang.c:10384 comp.lang.c++:10215

Cross-posted to 2 groups.

Show key headers only | View raw


Keith Thompson wrote:
> 
> pete <pfiland@mindspring.com> writes:
> > Tony wrote:
> >>
> >> Malcolm McLean wrote:
> >>
> >> > You should use int for an
> >> > integer unless there is a
> >> > clear reason for using another type. Though
> >> > each instance will only save a few cycles,
> >> > if you systematically use
> >> > int the speed increment may be worth having.
> >>
> >> Did you mean that just in the context of the OP/this thread, or in
> >> general?
> >
> > I only use data types which are smaller than int,
> > when there is a special reason.
> >
> > It's possible that small types may be aligned on int boundaries,
> > meaning that there may be unusable bytes in between them.
> 
> No, it's not.  In an array of char, or an array of short, the elements
> must be contiguous; unlike structs arrays have no padding.
> This is necessary
> to make array indexing and pointer arithmetic work.

It's possible that small types may exist outside of an array.

-- 
pete

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


Thread

datatype for bit flags Gr <g@g.com> - 2011-09-15 12:37 +0530
  Re: datatype for bit flags jacob navia <jacob@spamsink.net> - 2011-09-15 09:26 +0200
    Re: datatype for bit flags Gr <g@g.com> - 2011-09-15 13:33 +0530
      Re: datatype for bit flags jacob navia <jacob@spamsink.net> - 2011-09-15 10:12 +0200
  Re: datatype for bit flags Malcolm McLean <malcolm.mclean5@btinternet.com> - 2011-09-15 01:06 -0700
  Re: datatype for bit flags "BartC" <bc@freeuk.com> - 2011-09-15 10:56 +0100
    Re: datatype for bit flags Gr <g@g.com> - 2011-09-15 17:24 +0530
  Re: datatype for bit flags Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-09-16 01:16 +0300
    Re: datatype for bit flags Malcolm McLean <malcolm.mclean5@btinternet.com> - 2011-09-16 04:59 -0700
      Re: datatype for bit flags Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-09-16 20:46 +0000
        Re: datatype for bit flags pete <pfiland@mindspring.com> - 2011-09-16 18:00 -0400
        Re: datatype for bit flags Malcolm McLean <malcolm.mclean5@btinternet.com> - 2011-09-18 05:00 -0700
          Re: datatype for bit flags Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-09-18 13:36 +0000
      Re: datatype for bit flags "Tony" <nospamme@ever.net> - 2011-09-16 16:47 -0500
        Re: datatype for bit flags pete <pfiland@mindspring.com> - 2011-09-16 18:35 -0400
          Re: datatype for bit flags Keith Thompson <kst-u@mib.org> - 2011-09-16 16:25 -0700
            Re: datatype for bit flags pete <pfiland@mindspring.com> - 2011-09-17 02:35 -0400
              Re: datatype for bit flags Keith Thompson <kst-u@mib.org> - 2011-09-17 14:42 -0700
          Re: datatype for bit flags "Tony" <nospamme@ever.net> - 2011-09-16 19:27 -0500
  Re: datatype for bit flags hanukas <jukka@liimatta.org> - 2011-09-23 03:56 -0700

csiph-web