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


Groups > comp.lang.c > #169282

Re: FAQ list update: Q1.1: choosing types

From Keith Thompson <Keith.S.Thompson+u@gmail.com>
Newsgroups comp.lang.c
Subject Re: FAQ list update: Q1.1: choosing types
Date 2023-02-15 11:28 -0800
Organization None to speak of
Message-ID <87edqqranm.fsf@nosuchdomain.example.com> (permalink)
References (1 earlier) <a4d79dc0-db6d-4a94-9a52-fb603d75f1ccn@googlegroups.com> <87ttzoq943.fsf@nosuchdomain.example.com> <fb2a9938-72f1-438b-95de-ca580431f1e3n@googlegroups.com> <87pmaarden.fsf@nosuchdomain.example.com> <bc0d6df6-1856-4518-8d7d-f3d7febabaecn@googlegroups.com>

Show all headers | View raw


John Dill <jadill33@gmail.com> writes:
> On Wednesday, February 15, 2023 at 1:29:07 PM UTC-5, Keith Thompson wrote:
>> John Dill <jadi...@gmail.com> writes: 
[...]
>> > C_STATIC_ASSERT (sizeof (ssize_t) == sizeof (size_t), 
>> > ssize_t_is_compatible_with_size_t); 
>> > \endcode
[...]
>> The name "ssize_t_is_compatible_with_size_t" is a bit misleading. 
>> C type compatibility is defined very narrowly. A signed type is 
>> never *compatible* with an unsigned type. What is "compatible" 
>> supposed to mean in this context?
>
> That's a good point.  A better term is "size equivalent" perhaps?

I misread the arguments to the C_STATIC_ASSERT() macro; I thought you
were testing two different conditions.  I see that
    sizeof (ssize_t) == sizeof (size_t)
is the condition being tested, and
    size_t_is_compatible_with_size_t
is a name assigned to that condition (used in an error message?).

How about "size_t_ssize_t_same_size"?  (Yeah, it's a bit ugly.)

But is that really a requirement?  Note that POSIX doesn't guarantee
that size_t and ssize_t have the same size.  I'd be surprised by an
implementation in which their sizes differ.  But if size_t and ssize_t
are the same size, then there will be sizes representable as a size_t
that exceed SSIZE_MAX; if that's a problem for real code, an
implementation might make ssize_t bigger than size_t.

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for XCOM Labs
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

FAQ list update: Q1.1: choosing types scs@eskimo.com (Steve Summit) - 2023-02-13 15:18 +0000
  Re: FAQ list update: Q1.1: choosing types Anton Shepelev <anton.txt@g{oogle}mail.com> - 2023-02-13 18:27 +0300
  Re: FAQ list update: Q1.1: choosing types scott@slp53.sl.home (Scott Lurndal) - 2023-02-13 16:27 +0000
    Re: FAQ list update: Q1.1: choosing types Oğuz <oguzismailuysal@gmail.com> - 2023-02-14 08:55 +0300
  Re: FAQ list update: Q1.1: choosing types Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2023-02-13 18:07 +0000
  Re: FAQ list update: Q1.1: choosing types Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2023-02-13 10:48 -0800
  Re: FAQ list update: Q1.1: choosing types Kaz Kylheku <864-117-4973@kylheku.com> - 2023-02-14 03:10 +0000
    Re: FAQ list update: Q1.1: choosing types Blue-Maned_Hawk <bluemanedhawk@gmail.com> - 2023-02-14 17:33 -0500
  Re: FAQ list update: Q1.1: choosing types Öö Tiib <ootiib@hot.ee> - 2023-02-13 23:24 -0800
  Re: FAQ list update: Q1.1: choosing types bart c <bart4858@gmail.com> - 2023-02-14 06:22 -0800
    Re: FAQ list update: Q1.1: choosing types Blue-Maned_Hawk <bluemanedhawk@gmail.com> - 2023-02-14 17:48 -0500
  Re: FAQ list update: Q1.1: choosing types John Dill <jadill33@gmail.com> - 2023-02-14 08:17 -0800
    Re: FAQ list update: Q1.1: choosing types Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-02-14 12:34 -0800
      Re: FAQ list update: Q1.1: choosing types John Dill <jadill33@gmail.com> - 2023-02-15 10:04 -0800
        Re: FAQ list update: Q1.1: choosing types Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-02-15 10:28 -0800
          Re: FAQ list update: Q1.1: choosing types Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2023-02-15 10:57 -0800
            Re: FAQ list update: Q1.1: choosing types Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-02-15 11:17 -0800
              Re: FAQ list update: Q1.1: choosing types Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-02-15 11:32 -0800
          Re: FAQ list update: Q1.1: choosing types John Dill <jadill33@gmail.com> - 2023-02-15 11:01 -0800
            Re: FAQ list update: Q1.1: choosing types Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-02-15 11:28 -0800
              Re: FAQ list update: Q1.1: choosing types John Dill <jadill33@gmail.com> - 2023-02-15 14:00 -0800
  Re: FAQ list update: Q1.1: choosing types Tim Rentsch <tr.17687@z991.linuxsc.com> - 2023-02-15 02:54 -0800
  Re: FAQ list update: Q1.1: choosing types Anton Shepelev <anton.txt@g{oogle}mail.com> - 2023-02-15 14:43 +0300
  Re: FAQ list update: Q1.1: choosing types David Brown <david.brown@hesbynett.no> - 2023-02-15 13:55 +0100
    Re: FAQ list update: Q1.1: choosing types Malcolm McLean <malcolm.arthur.mclean@gmail.com> - 2023-02-15 05:31 -0800

csiph-web