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


Groups > comp.lang.c > #162929

Re: How to add ssize_t a by size_t b?

Path csiph.com!weretis.net!feeder8.news.weretis.net!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From Keith Thompson <Keith.S.Thompson+u@gmail.com>
Newsgroups comp.lang.c
Subject Re: How to add ssize_t a by size_t b?
Date Fri, 01 Oct 2021 18:42:17 -0700
Organization None to speak of
Lines 35
Message-ID <87lf3cgq2u.fsf@nosuchdomain.example.com> (permalink)
References <c64a2f9b-4745-42f4-9bd4-ce093fbc2d68n@googlegroups.com> <sj7h4g$19gs$1@gioia.aioe.org> <JtI5J.65761$ol1.6157@fx42.iad> <87pmsoh1st.fsf@nosuchdomain.example.com> <sj88eh$aub$1@dont-email.me>
Mime-Version 1.0
Content-Type text/plain
Injection-Info reader02.eternal-september.org; posting-host="94eff854053ef23283796f3a0cb49144"; logging-data="31751"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19EKeQezuOyzt9cRxlvRfvu"
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock sha1:232xYX1Fqd2i9Xwz3oTi72pOlWc= sha1:YRz1WjARdeeVWsbmO+wYMJCUmQo=
Xref csiph.com comp.lang.c:162929

Show key headers only | View raw


James Kuyper <jameskuyper@alumni.caltech.edu> writes:
> On 10/1/21 5:29 PM, Keith Thompson wrote:
>> scott@slp53.sl.home (Scott Lurndal) writes:
>>> Guillaume <message@bottle.org> writes:
>> [...]
>>>> ssize_t is not standard C. It's defined in POSIX.
>>>> While it's a signed integer, whereas size_t is unsigned, I don't know 
>>>> how it relates to size_t on a given implementation in terms of width. 
>>>
>>> POSIX specifies that sizeof(ssize_t) == sizeof(size_t).
>> 
>> Does it?  I couldn't find any such guarantee.
>> 
>> https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_types.h.html
>
> In <https://pubs.opengroup.org/onlinepubs/9699919799/toc.htm> it says
> the following about ssize_t:
>
> "The wording is such that an implementation may either choose to use a
> longer type or simply to use the signed version of the type that
> underlies size_t."
>
> Therefore, sizeof(ssize_t) > sizeof(size_t) is allowed. I have not yet
> located "the wording" that referred to above.

Because of the way the site uses frames, that URL isn't meaningful.  The
quote is from
https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xsh_chap02.html

I couldn't find "the wording" either.

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Philips
void Void(void) { Void(); } /* The recursive call of the void */

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


Thread

How to add ssize_t a by size_t b? wij <wyniijj@gmail.com> - 2021-10-01 08:32 -0700
  Re: How to add ssize_t a by size_t b? Guillaume <message@bottle.org> - 2021-10-01 19:39 +0200
    Re: How to add ssize_t a by size_t b? scott@slp53.sl.home (Scott Lurndal) - 2021-10-01 18:31 +0000
      Re: How to add ssize_t a by size_t b? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-10-01 14:29 -0700
        Re: How to add ssize_t a by size_t b? James Kuyper <jameskuyper@alumni.caltech.edu> - 2021-10-01 20:17 -0400
          Re: How to add ssize_t a by size_t b? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-10-01 18:42 -0700
            Re: How to add ssize_t a by size_t b? Manfred <noname@add.invalid> - 2021-10-02 20:17 +0200
              Re: How to add ssize_t a by size_t b? James Kuyper <jameskuyper@alumni.caltech.edu> - 2021-10-02 15:03 -0400
    Re: How to add ssize_t a by size_t b? James Kuyper <jameskuyper@alumni.caltech.edu> - 2021-10-01 14:53 -0400
      Re: How to add ssize_t a by size_t b? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-10-02 15:13 -0700
  Re: How to add ssize_t a by size_t b? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-10-01 14:13 -0700
    Re: How to add ssize_t a by size_t b? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-10-02 14:52 -0700
  Re: How to add ssize_t a by size_t b? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-10-02 14:47 -0700
  Re: How to add ssize_t a by size_t b? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-10-06 04:06 -0700

csiph-web