Thread: uint32_t or uint32

  1. #1
    char main() RoshanX's Avatar
    Join Date
    Mar 2003
    Posts
    68

    uint32_t or uint32

    hi all,

    is uint32 ( or uint32_t ) a built in type or a typedef ?.
    If it's a typedef ( or a macro ) where is it defined ?

    Thank you.
    First there was God. He was quite lonely, so he created Dennis.
    Dennis was unimpressed with God.
    So, . . . God created Brian..........Khan Klatt
    http://www.clifford.at/fun/GOD

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Edit, try stdint.h for C99.


    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    char main() RoshanX's Avatar
    Join Date
    Mar 2003
    Posts
    68
    Is this not defined for win32 ?
    ( it was a typedef in stdint.h )
    First there was God. He was quite lonely, so he created Dennis.
    Dennis was unimpressed with God.
    So, . . . God created Brian..........Khan Klatt
    http://www.clifford.at/fun/GOD

  4. #4
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    Huh? C99 is anywhere. If you have a standards-conforming C99 compiler, you shouldn't need to worry about platform dependencies.

  5. #5
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    They're not standard. Or at least they weren't before C99. C99 I believe may optionally have them.
    7.18.1.1 Exact-width integer types

    1 The typedef name intN_t designates a signed integer type with width N, no padding
    bits, and a two’s complement representation. Thus, int8_t denotes a signed integer
    type with a width of exactly 8 bits.
    2 The typedef name uintN_t designates an unsigned integer type with width N. Thus,
    uint24_t denotes an unsigned integer type with a width of exactly 24 bits.
    3 These types are optional. However, if an implementation provides integer types with
    widths of 8, 16, 32, or 64 bits, it shall define the corresponding typedef names.
    This is from C99.


    Quzah.
    Hope is the first step on the road to disappointment.

  6. #6
    int x = *((int *) NULL); Cactus_Hugger's Avatar
    Join Date
    Jul 2003
    Location
    Banks of the River Styx
    Posts
    902
    They're not everywhere. If you plan to compile for odd platforms, you should probably check and provide for the odd case. I wish they were more places, uint32_t and friends are darn useful.
    They're usually located in stdint.h. (I've yet to see them elsewhere.) My Windows box has them, and Linux has them. (Or mine does, at least.) Macs, I should hope, have them. However, OS/2 using gcc3.2.1 apperantly does not. (It has no stdint.h file for me. Watcom does I think.) The robot I've coded for does not have an stdint.h.

    quzah - reading that 3rd item, the part about "if an implemenation provides integer types with widths of 8..." would mandate it for most compilers, would it not? I have never seen a situation where 8 * sizeof(int) did not equal one of the listed numbers, and would that not cause that However-clause to take effect?
    long time; /* know C? */
    Unprecedented performance: Nothing ever ran this slow before.
    Any sufficiently advanced bug is indistinguishable from a feature.
    Real Programmers confuse Halloween and Christmas, because dec 25 == oct 31.
    The best way to accelerate an IBM is at 9.8 m/s/s.
    recursion (re - cur' - zhun) n. 1. (see recursion)

  7. #7
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    I read it as:

    1 - the typedefname ifooN will be exactly N bits wide, no padding is allowed
    2 - the typedefname ufooN will be exactly N bites wide, and unsigned
    3 - regarding the above, these fooN types are optional, but, if they're there, they will be typedefed appropriately to their respective type and size


    Quzah.
    Hope is the first step on the road to disappointment.

  8. #8
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Perhaps the best way to go then is typedef your own?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. brace-enclosed error
    By jdc18 in forum C++ Programming
    Replies: 53
    Last Post: 05-03-2007, 05:49 PM
  2. MD5 hashing problems =(
    By Uncle Rico in forum C Programming
    Replies: 4
    Last Post: 02-28-2005, 10:31 AM
  3. MD5 Algorithm
    By Inquirer in forum C Programming
    Replies: 2
    Last Post: 12-28-2003, 11:55 PM
  4. bit shifting
    By Nor in forum C++ Programming
    Replies: 9
    Last Post: 08-08-2003, 11:55 AM
  5. libtiff: TIFFWriteRGBAImage()?
    By dug in forum Game Programming
    Replies: 1
    Last Post: 07-09-2003, 09:01 AM