All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ribamar Santarosa de Sousa <ribamar@fee.unicamp.br>
To: Brian Raiter <breadbox@muppetlabs.com>
Cc: linux-assembly@vger.kernel.org
Subject: Re: newbie question about integers size/portabilty.
Date: Tue, 28 Dec 2004 21:52:27 -0200	[thread overview]
Message-ID: <20041228235227.GA28029@ic.unicamp.br> (raw)
In-Reply-To: <16849.57445.118809.760890@eidolon.muppetlabs.com>

> > I seem to recall seeing macros in C code like sizeof(int) used to
> > figure out the size of things and then conditionally compile code.
> 
> sizeof isn't a macro, actually, and it cannot be used to conditionally
> compile code. For most cases, you can simply rely on the guaranteed
> sizes I mentioned above. If you're dealing with circumstances in which
> you really need to know EXACT sizes, then your best option is to use
> the macros in <limits.h>. In this header file are defined macros such
> as CHAR_BIT, INT_MIN, ULONG_MAX, etc etc etc.
> http://www-ccs.ucsd.edu/c/limits.html shows what the ANSI C standard
> defines. (POSIX defines a number of other macros to be included.)
> 

I really needed of documentation on data syzes  and no code would save me
because i don't have all the machines 
that the code could work. The code was written with (i guess) not with the
best pratices in this point, it uses int, short , long instead the data 
types defined in linux/types.h (__u16, __s8, ...)... I am making these 
changes and in the future no one will need worry about size of data 
structures. 

And thanks Brian for the corrections on some points touched by Cooper :)
Riba




  reply	other threads:[~2004-12-28 23:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-28 12:29 newbie question about integers size/portabilty Ribamar Santarosa de Sousa
2004-12-28 13:35 ` Richard Cooper
2004-12-28 15:20   ` Ribamar Santarosa de Sousa
2004-12-30  9:10     ` Frederic Marmond
2004-12-28 22:38   ` Brian Raiter
2004-12-28 23:52     ` Ribamar Santarosa de Sousa [this message]
2004-12-29  0:17       ` Brian Raiter
2004-12-29  1:05         ` Ribamar Santarosa de Sousa
2004-12-29  1:31           ` Herbert Poetzl
2004-12-29  7:21     ` OT: " Richard Cooper

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=20041228235227.GA28029@ic.unicamp.br \
    --to=ribamar@fee.unicamp.br \
    --cc=breadbox@muppetlabs.com \
    --cc=linux-assembly@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.