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


Groups > comp.lang.c > #168594

Re: string to size_t

From Oğuz <oguzismailuysal@gmail.com>
Newsgroups comp.lang.c
Subject Re: string to size_t
Date 2022-12-19 21:34 +0300
Organization A noiseless patient Spider
Message-ID <tnqars$dk10$1@dont-email.me> (permalink)
References <tnph4t$8ind$1@dont-email.me> <87r0wvs291.fsf@nosuchdomain.example.com>

Show all headers | View raw


On 12/19/22 8:59 PM, Keith Thompson wrote:
> What is the point of trying strotoimax before using strotoumax?
To see if the string represents a negative value and fail; can't do that 
with strtoumax alone (or I don't know how to). For example, if I call 
strtoumax("-40", NULL, 10), it returns 18446744073709551576 (UINTMAX_MAX 
- 39) on my computer and leaves errno unchanged. I don't want that, 
perhaps it wasn't clear in OP.

> The checks are probably unnecessary.  As of the current C standard,
> SIZE_MAX cannot be bigger than UINT_MAX.
I didn't know this. Not sure how much adoption the current C standard 
found but it's definitely a step forward for the language. Good.

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


Thread

string to size_t Oğuz <oguzismailuysal@gmail.com> - 2022-12-19 14:15 +0300
  Re: string to size_t Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2022-12-19 09:59 -0800
    Re: string to size_t Oğuz <oguzismailuysal@gmail.com> - 2022-12-19 21:34 +0300
      Re: string to size_t Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2022-12-19 10:49 -0800
        Re: string to size_t Richard Damon <Richard@Damon-Family.org> - 2022-12-19 14:29 -0500
          Re: string to size_t Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2022-12-19 12:05 -0800
    Re: string to size_t scott@slp53.sl.home (Scott Lurndal) - 2022-12-19 18:40 +0000
      Re: string to size_t Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2022-12-19 12:07 -0800
        Re: string to size_t scott@slp53.sl.home (Scott Lurndal) - 2022-12-19 20:31 +0000
      Re: string to size_t Tony Oliver <guinness.tony@gmail.com> - 2022-12-19 16:33 -0800
    Re: string to size_t Tim Rentsch <tr.17687@z991.linuxsc.com> - 2022-12-19 11:20 -0800
  Re: string to size_t Ben Bacarisse <ben.usenet@bsb.me.uk> - 2022-12-19 22:16 +0000

csiph-web