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


Groups > comp.lang.c > #384349

Re: Recursion, Yo

Path csiph.com!news.swapon.de!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From Keith Thompson <Keith.S.Thompson+u@gmail.com>
Newsgroups comp.lang.c
Subject Re: Recursion, Yo
Date Mon, 15 Apr 2024 12:00:30 -0700
Organization None to speak of
Lines 50
Message-ID <87bk6asb75.fsf@nosuchdomain.example.com> (permalink)
References <uut24f$2icpb$1@dont-email.me> <uv5gfd$qum1$1@dont-email.me> <uv5lgl$s6uj$1@dont-email.me> <uv61f6$v1jm$1@dont-email.me> <uv68ok$11080$1@dont-email.me> <uv7a8n$18qf8$3@dont-email.me> <uv867l$1j8l6$1@dont-email.me> <_zSRN.161297$m4d.144795@fx43.iad> <20240411075825.30@kylheku.com> <r8TRN.114606$Wbff.54968@fx37.iad> <uva6ep$24ji7$1@dont-email.me> <uvah1j$26gtr$1@dont-email.me> <uvao71$27qit$1@dont-email.me> <uvb9r4$2c31v$1@dont-email.me> <uvcing$2kbfj$6@dont-email.me> <20240413203303.000001f9@yahoo.com> <878r1grgn3.fsf@bsb.me.uk> <20240414032902.00003dc8@yahoo.com> <uvj8qp$9s2q$1@dont-email.me> <87frvmsk6u.fsf@nosuchdomain.example.com> <87jzkypo7s.fsf@bsb.me.uk>
MIME-Version 1.0
Content-Type text/plain
Injection-Date Mon, 15 Apr 2024 21:00:44 +0200 (CEST)
Injection-Info dont-email.me; posting-host="73a59417e165fb25aa14cac8ac742e2a"; logging-data="478112"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/HSAJqBCRReygnGVsBLEzx"
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Cancel-Lock sha1:P/x9TZV8TElbgHj2dR9TJs2w8T8= sha1:P8LtUW2StKMBI5z06/5hwTHkQos=
Xref csiph.com comp.lang.c:384349

Show key headers only | View raw


Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
> Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
>> Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
>>> On 14.04.2024 02:29, Michael S wrote:
> <Algol 68 code elided>
>>>> It looks closer to C than to Pascal, i.e. pointer can point to any
>>>> object rather than just to dynamically allocated object.
>>>
>>> The major difference is that they are closely bound to the type.
>>> In that respect they are more like Pascal pointers. C pointers
>>> open the can of issues with arithmetic on pointer values. You
>>> don't find that in Pascal or Algol 68.
>> [...]
>>
>> How are C pointers not "closely bound to the type"?
>
>   int i = 42;
>   memcpy(&i, &(float){3.14}, sizeof i);
>   printf("%d\n", i);
>
> That looks like a pretty loose association between pointer and object
> type to me.  This is not an accident or an unintended loophole.  It's by
> design.
>
> Certainly every pointer value in C has an associated type, but the
> intention is that this association can be changed by pointer type
> conversion as needed.
>
> You often /have/ to make us of this.  For example, when calling qsort,
> you will usually change the association between the pointer and the
> pointed-to type (void) in order to do the comparison.  And C does not
> even insist that you change it back to the original pointed-to type as
> you can legally write a comparison function for, say, float data that
> uses the representation as "raw" bytes.

OK.  The way I'd describe it is that C (non-void) pointers *are*
"closely bound to the type", but in addition C provides operations,
particularly pointer casts and implicit conversions to and from void*,
that can override that binding.

Janis mentioned pointer arithmetic.  I wouldn't say that overrides the
type binding; it merely provides a set of operations, that some other
languages lack, for constructing a pointer value from another pointer
value.  I don't know whether Janis meant that to be an example of not
being closely bound to the type, or as a distinct statement.

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

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


Thread

Recursion, Yo Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-04-07 02:58 +0000
  Re: Recursion, Yo fir <fir@grunge.pl> - 2024-04-07 11:52 +0200
    Re: Recursion, Yo Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-04-09 10:25 +0200
      Re: Recursion, Yo Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-04-09 08:43 +0000
        Re: Recursion, Yo Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-04-09 14:27 +0200
          Re: Recursion, Yo Ben Bacarisse <ben.usenet@bsb.me.uk> - 2024-04-09 15:27 +0100
            Re: Recursion, Yo Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-04-09 21:55 +0200
              Re: Recursion, Yo Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-04-09 13:31 -0700
                Re: Recursion, Yo Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-04-10 08:30 +0200
        Re: Recursion, Yo bart <bc@freeuk.com> - 2024-04-09 15:02 +0100
      Re: Recursion, Yo Ben Bacarisse <ben.usenet@bsb.me.uk> - 2024-04-09 11:44 +0100
        Re: Recursion, Yo Ben Bacarisse <ben.usenet@bsb.me.uk> - 2024-04-09 13:25 +0100
        Re: Recursion, Yo Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-04-10 01:50 +0000
          Re: Recursion, Yo "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-04-09 20:54 -0700
          Re: Recursion, Yo David Brown <david.brown@hesbynett.no> - 2024-04-10 09:11 +0200
            Re: Recursion, Yo Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-04-10 07:52 +0000
              Re: Recursion, Yo David Brown <david.brown@hesbynett.no> - 2024-04-10 11:18 +0200
                Re: Recursion, Yo bart <bc@freeuk.com> - 2024-04-10 13:42 +0100
                Re: Recursion, Yo David Brown <david.brown@hesbynett.no> - 2024-04-10 16:46 +0200
                Re: Recursion, Yo Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-04-11 00:18 +0000
                Re: Recursion, Yo Kaz Kylheku <643-408-1753@kylheku.com> - 2024-04-11 00:54 +0000
                Heh heh...  (Was: Recursion, Yo) gazelle@shell.xmission.com (Kenny McCormack) - 2024-04-11 08:00 +0000
                Re: Heh heh...  (Was: Recursion, Yo) Kaz Kylheku <643-408-1753@kylheku.com> - 2024-04-11 15:13 +0000
                Re: Heh heh...  (Was: Recursion, Yo) gazelle@shell.xmission.com (Kenny McCormack) - 2024-04-11 19:06 +0000
                Re: Recursion, Yo Kaz Kylheku <643-408-1753@kylheku.com> - 2024-04-11 15:04 +0000
                Re: Recursion, Yo David Brown <david.brown@hesbynett.no> - 2024-04-11 20:47 +0200
                Re: Recursion, Yo scott@slp53.sl.home (Scott Lurndal) - 2024-04-11 15:15 +0000
                Re: Recursion, Yo Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-04-12 02:31 +0000
                Re: Recursion, Yo Kaz Kylheku <643-408-1753@kylheku.com> - 2024-04-12 03:51 +0000
                Re: Recursion, Yo cross@spitfire.i.gajendra.net (Dan Cross) - 2024-04-12 12:51 +0000
                Re: Recursion, Yo Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-04-12 07:32 +0200
                Re: Recursion, Yo David Brown <david.brown@hesbynett.no> - 2024-04-12 09:30 +0200
                Re: Recursion, Yo Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-04-12 15:03 +0200
                Re: Recursion, Yo David Brown <david.brown@hesbynett.no> - 2024-04-12 16:51 +0200
                Re: Recursion, Yo Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-04-13 19:17 +0200
                Re: Recursion, Yo David Brown <david.brown@hesbynett.no> - 2024-04-13 20:04 +0200
                Re: Recursion, Yo Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-04-13 00:10 +0000
                Re: Recursion, Yo Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-04-12 07:34 +0000
                Re: Recursion, Yo Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-04-12 14:35 +0200
                Re: Recursion, Yo bart <bc@freeuk.com> - 2024-04-12 16:42 +0100
                Re: Recursion, Yo Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-04-13 00:13 +0000
                Re: Recursion, Yo Michael S <already5chosen@yahoo.com> - 2024-04-13 20:33 +0300
                Re: Recursion, Yo Ben Bacarisse <ben.usenet@bsb.me.uk> - 2024-04-14 00:23 +0100
                Re: Recursion, Yo Michael S <already5chosen@yahoo.com> - 2024-04-14 03:29 +0300
                Re: Recursion, Yo Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-04-15 15:07 +0200
                Re: Recursion, Yo Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-04-15 08:46 -0700
                Re: Recursion, Yo Ben Bacarisse <ben.usenet@bsb.me.uk> - 2024-04-15 17:47 +0100
                Re: Recursion, Yo Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-04-15 12:00 -0700
                Re: Recursion, Yo bart <bc@freeuk.com> - 2024-04-15 20:24 +0100
                Re: Recursion, Yo Ben Bacarisse <ben.usenet@bsb.me.uk> - 2024-04-15 21:37 +0100
                Re: Recursion, Yo Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-04-15 22:39 +0200
                Re: Recursion, Yo Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-04-15 22:54 +0200
                Re: Recursion, Yo Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-04-15 14:25 -0700
                Re: Recursion, Yo Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-04-14 00:29 +0000
                Re: Recursion, Yo Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-04-13 20:05 -0700
                Re: Recursion, Yo Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-04-13 19:37 +0200
                Re: Recursion, Yo Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-04-14 00:28 +0000
                Re: Recursion, Yo Ben Bacarisse <ben.usenet@bsb.me.uk> - 2024-04-14 11:17 +0100
                Re: Recursion, Yo bart <bc@freeuk.com> - 2024-04-14 13:51 +0100
                Re: Recursion, Yo Ben Bacarisse <ben.usenet@bsb.me.uk> - 2024-04-14 22:47 +0100
                Re: Recursion, Yo Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-04-14 22:44 +0000
                Re: Recursion, Yo "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2024-04-14 20:35 -0700
                Re: Recursion, Yo Ben Bacarisse <ben.usenet@bsb.me.uk> - 2024-04-15 17:50 +0100
                Re: Recursion, Yo Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-04-15 22:30 +0000
                Re: Recursion, Yo Ben Bacarisse <ben.usenet@bsb.me.uk> - 2024-04-17 18:09 +0100
                Re: Recursion, Yo Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-04-17 22:12 +0000
                Re: Recursion, Yo Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-04-22 18:06 +0200
                Re: Recursion, Yo Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-04-15 20:36 +0200
                Re: Recursion, Yo Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-04-15 22:32 +0000
                Re: Recursion, Yo Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-04-22 17:41 +0200
                Re: Recursion, Yo Michael S <already5chosen@yahoo.com> - 2024-04-16 23:11 +0300
                Re: Recursion, Yo Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-04-19 08:26 -0700
                Re: Recursion, Yo scott@slp53.sl.home (Scott Lurndal) - 2024-04-19 18:25 +0000
                Re: Recursion, Yo Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-04-19 12:15 -0700
                Re: Recursion, Yo Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-04-20 05:55 -0700
                Re: Recursion, Yo bart <bc@freeuk.com> - 2024-04-19 19:34 +0100
                Re: Recursion, Yo Ben Bacarisse <ben.usenet@bsb.me.uk> - 2024-04-20 02:11 +0100
                Re: Recursion, Yo Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-04-19 18:24 -0700
                Re: Recursion, Yo Kaz Kylheku <643-408-1753@kylheku.com> - 2024-04-20 15:35 +0000
                Re: Recursion, Yo Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-04-19 12:18 -0700
                Re: Recursion, Yo Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-04-20 06:03 -0700
                Re: Recursion, Yo Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-04-22 17:49 +0200
                Re: Recursion, Yo Ben Bacarisse <ben.usenet@bsb.me.uk> - 2024-04-15 17:50 +0100
                Re: Recursion, Yo bart <bc@freeuk.com> - 2024-04-12 10:38 +0100
                Re: Recursion, Yo Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-04-12 15:07 +0200
                Re: Recursion, Yo bart <bc@freeuk.com> - 2024-04-12 16:38 +0100
                Re: Recursion, Yo Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-04-12 19:06 -0700
                Re: Recursion, Yo Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-04-13 07:46 -0700
                Re: Recursion, Yo scott@slp53.sl.home (Scott Lurndal) - 2024-04-11 14:36 +0000
                Re: Recursion, Yo David Brown <david.brown@hesbynett.no> - 2024-04-11 10:15 +0200
                Re: Recursion, Yo Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2024-04-11 12:37 -0700
                Re: Recursion, Yo David Brown <david.brown@hesbynett.no> - 2024-04-12 09:38 +0200
                Re: Recursion, Yo fir <fir@grunge.pl> - 2024-04-14 20:34 +0200
                Re: Recursion, Yo Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2024-04-10 15:18 +0200
                Re: Recursion, Yo scott@slp53.sl.home (Scott Lurndal) - 2024-04-10 14:23 +0000
                Re: Recursion, Yo Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-04-11 00:16 +0000
                Re: Recursion, Yo scott@slp53.sl.home (Scott Lurndal) - 2024-04-11 14:34 +0000
                Re: Recursion, Yo Ben Bacarisse <ben.usenet@bsb.me.uk> - 2024-04-12 00:04 +0100
                Re: Recursion, Yo Kaz Kylheku <643-408-1753@kylheku.com> - 2024-04-10 17:19 +0000
                Re: Recursion, Yo David Brown <david.brown@hesbynett.no> - 2024-04-10 21:19 +0200
                Re: Recursion, Yo Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-04-11 00:54 +0000
                Re: Recursion, Yo Kaz Kylheku <643-408-1753@kylheku.com> - 2024-04-11 02:06 +0000
                Re: Recursion, Yo David Brown <david.brown@hesbynett.no> - 2024-04-11 10:23 +0200
                Re: Recursion, Yo Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-04-11 08:34 +0000
            Re: Recursion, Yo Kaz Kylheku <643-408-1753@kylheku.com> - 2024-04-10 17:10 +0000
          Re: Recursion, Yo Tim Rentsch <tr.17687@z991.linuxsc.com> - 2024-04-10 10:14 -0700
  Re: Recursion, Yo Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-04-09 08:44 +0000

csiph-web