limits for size_t

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • copx

    limits for size_t

    How do you figure out the maximal valid value for size_t in C89?
    C99's stdint.h defines SIZE_MAX but I found nothing in the C89 headers..


  • Ben Pfaff

    #2
    Re: limits for size_t

    "copx" <copx@gazeta.pl writes:
    How do you figure out the maximal valid value for size_t in C89?
    (size_t) -1
    --
    "The fact that there is a holy war doesn't mean that one of the sides
    doesn't suck - usually both do..."
    --Alexander Viro

    Comment

    • copx

      #3
      Re: limits for size_t


      "Ben Pfaff" <blp@cs.stanfor d.eduschrieb im Newsbeitrag
      news:87ve16aot7 .fsf@blp.benpfa ff.org...
      "copx" <copx@gazeta.pl writes:
      >
      >How do you figure out the maximal valid value for size_t in C89?
      >
      (size_t) -1
      size_t is guaranteed to be an unsigned integer type?


      Comment

      • Pietro Cerutti

        #4
        Re: limits for size_t

        copx wrote:
        "Ben Pfaff" <blp@cs.stanfor d.eduschrieb im Newsbeitrag
        news:87ve16aot7 .fsf@blp.benpfa ff.org...
        >"copx" <copx@gazeta.pl writes:
        >>
        >>How do you figure out the maximal valid value for size_t in C89?
        >(size_t) -1
        >
        size_t is guaranteed to be an unsigned integer type?

        Yes,

        6.5.3.4 The sizeof operator
        4 The value of the result is implementation-defined, and its
        type (an unsigned integer type) is size_t, defined in
        <stddef.h(and other headers).

        --
        Pietro Cerutti

        Comment

        Working...