Unsigned int, uint16, uint32_t

Hi everybody again!!!

I?m new in SDl and C++
until nowadays I develop my games with java and now
I am reprogramming my java graphic engine with SDL library

Is a very hard work

I have one question about int literals, I have seen that there are a lot of
of theme
int, unsigned int, uint16, uint32, uint32_t
I understand the
concept of using 16 bit or 32 bit int, but what is the difference between
uint32 and uint32_t?

Sometimes I miss java

Francisco Bodego Franco

Ikasplay, S.L.

Parque Tecnol?gico de Miram?n

Paseo Mikeletegi 54

20009 San Sebasti?n

www.ikasplay.es

tel: 943 30 92 77

Ikasplay-mini

01001001 01101011 01100001 01110011 01110000 01101100 01100001 01111001

-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: image/jpeg
Size: 4647 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20090408/a38342db/attachment.jpeg

man stdint.h or http://en.wikipedia.org/wiki/Stdint.h

for the most part i only use the stdint.h types. for sdl funtions or
other library funtions i will usually use the type that their funtion
returns, Uint32 for example.On Wed, 8 Apr 2009, Francisco Bodego Franco wrote:

Hi everybody again!!!

I?m new in SDl and C++? until nowadays I develop my games with java and now
I am reprogramming my java graphic engine with SDL library?

Is a very hard work?

I have one question about int literals, I have seen that there are a lot of
of theme? int, unsigned int, uint16, uint32, uint32_t? I understand the
concept of using 16 bit or 32 bit int, but what is the difference between
uint32 and uint32_t?

Coming from Java, you have the perspective that there is a very small
set of pre-defined atomic types (you don’t even get unsigned numeric
types!) in addition to formal classes.

In C, however, we have a number of different means of representing a
"kind" of thing, some formal, others less formal. It’s a bit of a mess
compared to Java. C has:

  • built-in types
  • standard headers to define types quasi-built-in types
  • types can be defined with typedef
  • types can also be defined with macros (#define)
  • all atomic types can be cast (truncation? padding? signed padding?)
  • types can be transparent or opaque
  • enum!

Built-in C types like “int” and “long” do not consistently mean the
same thing! So the C99 standard gave us more explicit types like
"int32_t" which specify its sign and size very clearly. However since
you can’t even always depend on those being around, it’s good practice
for projects which seek high levels of portability (like SDL) to
define their own types to be used with their software. Those types
will of course ultimately at compile-time be defined in terms of other
types which are provided by your compiler environment.

There is not “uint32” with a lowercase “u” (well, there probably is,
but not here!)

“Uint32” with a capital “U” is a type defined in the SDL headers.

“uint32_t” is a type defined by C99 found in (I think) stdint.hOn Wed, Apr 8, 2009 at 11:26 AM, Francisco Bodego Franco wrote:

what is the difference between uint32 and uint32_t?


http://codebad.com/