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


Groups > comp.lang.c > #112214

Re: isspace() executes without ctype header?

From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c
Subject Re: isspace() executes without ctype header?
Date 2017-06-14 12:03 -0700
Organization None to speak of
Message-ID <lnk24ecrxr.fsf@kst-u.example.com> (permalink)
References (3 earlier) <kfno9tq7fpd.fsf@x-alumni2.alumni.caltech.edu> <ivd0B.96368$3k.53796@fx03.am4> <ln4lviecup.fsf@kst-u.example.com> <USd0B.212390$kd6.181170@fx33.am4> <65b55827-2e50-474e-8b47-a5d70747b53b@googlegroups.com>

Show all headers | View raw


supercat@casperkitty.com writes:
> On Wednesday, June 14, 2017 at 11:54:20 AM UTC-5, Bart wrote:
>> In the second example, the argument type is char*, the assumed parameter 
>> type is int. Why doesn't it complain about pointer to int conversion? It 
>> will do so when the int parameter is properly declared.
>
> The assumed return type is "int".  The assumed parameter type is whatever
> would match an argument that has been subjected to default promotions.
> When C was first designed, there were three categories of arguments, and
> thus three types of parameters:
>
>   A pointer of some kind (pass as the bulkiest pointer type)
>   A floating-point number of some kind (pass as the bulkiest FP type)
>   An integer of some kind (pass as the bulkiest integer type)

I don't recall there being any concept of the "bulkiest pointer
type".  Pointer types are distinct, and an int* argument would
be passed as int* even if char* is bigger.  (Note that there was
no void*.)  If you passed an int* argument to a function expecting a
char*, I think you'd have what C currently calls undefined behavior,
particularly if they have different representations.

Both cman74.pdf and cman.pdf (from 1975, I think) says that char
arguments are promoted to int, and float arguments to double.
(char, int, float, and double were the only numeric types.)
No other conversions are specified.


> The principle that the type used to pass an argument to a parameter of
> unknown type should depend merely on the category, rather than its exact
> type, is a good one, but was not retained when C added more types.  It
> works fine for the C74 types, though.

Yes, when long and long double were added, the unstated "bulkiest type"
rule was not extended to include them.  But I'm not convinced there ever
was such a rule, even implicitly, since it never applied to pointers.
(Or, later, to structs and unions.)

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

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


Thread

isspace() executes without ctype header? DFS <nospam@dfs.com> - 2017-06-13 21:13 -0400
  Re: isspace() executes without ctype header? Ian Collins <ian-news@hotmail.com> - 2017-06-14 13:20 +1200
    Re: isspace() executes without ctype header? DFS <nospam@dfs.com> - 2017-06-13 21:33 -0400
      Re: isspace() executes without ctype header? Ian Collins <ian-news@hotmail.com> - 2017-06-14 13:35 +1200
        Re: isspace() executes without ctype header? DFS <nospam@dfs.com> - 2017-06-13 22:31 -0400
          Re: isspace() executes without ctype header? Ian Collins <ian-news@hotmail.com> - 2017-06-14 14:40 +1200
  Re: isspace() executes without ctype header? Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2017-06-13 21:49 -0400
  Re: isspace() executes without ctype header? Tim Rentsch <txr@alumni.caltech.edu> - 2017-06-13 19:20 -0700
    Re: isspace() executes without ctype header? DFS <nospam@dfs.com> - 2017-06-13 23:04 -0400
      Re: isspace() executes without ctype header? asetofsymbols@gmail.com - 2017-06-13 23:07 -0700
      Re: isspace() executes without ctype header? Tim Rentsch <txr@alumni.caltech.edu> - 2017-06-14 08:26 -0700
        Re: isspace() executes without ctype header? bartc <bc@freeuk.com> - 2017-06-14 17:29 +0100
          Re: isspace() executes without ctype header? Keith Thompson <kst-u@mib.org> - 2017-06-14 09:46 -0700
            Re: isspace() executes without ctype header? bartc <bc@freeuk.com> - 2017-06-14 17:54 +0100
              Re: isspace() executes without ctype header? Keith Thompson <kst-u@mib.org> - 2017-06-14 10:17 -0700
              Re: isspace() executes without ctype header? supercat@casperkitty.com - 2017-06-14 10:48 -0700
                Re: isspace() executes without ctype header? Keith Thompson <kst-u@mib.org> - 2017-06-14 12:03 -0700
                Re: isspace() executes without ctype header? supercat@casperkitty.com - 2017-06-14 12:48 -0700
                Re: isspace() executes without ctype header? Keith Thompson <kst-u@mib.org> - 2017-06-14 13:06 -0700
            Re: isspace() executes without ctype header? Tim Rentsch <txr@alumni.caltech.edu> - 2017-06-16 23:14 -0700
  Re: isspace() executes without ctype header? bartc <bc@freeuk.com> - 2017-06-14 11:18 +0100
    Re: isspace() executes without ctype header? Keith Thompson <kst-u@mib.org> - 2017-06-14 09:35 -0700
      Re: isspace() executes without ctype header? bartc <bc@freeuk.com> - 2017-06-14 17:47 +0100
        Re: isspace() executes without ctype header? supercat@casperkitty.com - 2017-06-14 10:19 -0700
          Re: isspace() executes without ctype header? Keith Thompson <kst-u@mib.org> - 2017-06-14 10:29 -0700
        Re: isspace() executes without ctype header? Keith Thompson <kst-u@mib.org> - 2017-06-14 10:21 -0700
          Re: isspace() executes without ctype header? bartc <bc@freeuk.com> - 2017-06-14 19:12 +0100
            Re: isspace() executes without ctype header? Keith Thompson <kst-u@mib.org> - 2017-06-14 12:12 -0700
            Re: isspace() executes without ctype header? joel.rees@gmail.com - 2017-06-16 17:56 -0700
              Re: isspace() executes without ctype header? supercat@casperkitty.com - 2017-06-17 10:20 -0700
                Re: isspace() executes without ctype header? Robert Wessel <robertwessel2@yahoo.com> - 2017-06-18 00:25 -0500
                Re: isspace() executes without ctype header? supercat@casperkitty.com - 2017-06-19 09:01 -0700
                Re: isspace() executes without ctype header? Robert Wessel <robertwessel2@yahoo.com> - 2017-06-19 21:59 -0500

csiph-web