Re: Threads across programming languages

Liste des GroupesRevenir à l c 
Sujet : Re: Threads across programming languages
De : Keith.S.Thompson+u (at) *nospam* gmail.com (Keith Thompson)
Groupes : comp.lang.c
Date : 24. May 2024, 01:31:15
Autres entêtes
Organisation : None to speak of
Message-ID : <871q5s3y2k.fsf@nosuchdomain.example.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
User-Agent : Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
[...]
>
First, a pointer is not an object.  In both C and C++, any pointer,
including a function pointer, is a scalar value.  A pointer value
might be held in an object but it doesn't have to be.  In most cases
function pointers are not stored in objects but simply used to call
the function pointed to.
>
[...]
>
Certainly a pointer value is not an object.  Certainly a pointer
object *is* an object.  It's not uncommon to informally refer to a
pointer object as "a pointer".  I presume you would consider such
usage to be incorrect, and I don't disagree, but it is fairly
common.
>
Good usage will be precise and logically consistent, adhere to the
rules of normal English usage, and align with how terminology and
phrasing is used in the C standard.  On the flip side, it is best
to try to avoid phrasing that is haphazard, careless, confusing,
or sloppy.

That's obvious (and a bit condescending).

I don't remember ever seeing the phrase "pointer object" used to
mean a pointer value, either informally or otherwise.  The C
standard does use the phrase "pointer object" in some places, but
it means something quite different from a pointer, namely, an
object that has pointer type (and not a pointer itself).  A local
declaration such as
>
   int *p;
>
introduces the identifier 'p' as (a way to designate) a pointer
object, but there is no pointer value anywhere in sight.

Obviously, and I can't figure out why you feel the need to make that
point.  Of course the phrase "pointer object" doesn't mean "pointer
value".  I didn't suggest that it could, or that anyone might think it
could.

I often find it useful to avoid referring to "pointers", and
instead refer to "pointer types", "pointer values", "pointer
objects", and so on (likewise for arrays).
>
I have the impression that you are someone who is unusually averse
to ambiguity.  I appreciate that your suggestions are given with
the idea that they will help with clarity of communication.
Unfortunately they don't always help, and sometimes make things
worse rather than better.  Your comment here is a case in point.
The C standard uses the word pointer (or pointers) in a little
over 900 places.  In most of those, pointer is used as a simple
noun;  whether in each case it refers to a type or a run-time
value is clear from context.  Notably, the C standard uses the
phrase "pointer value" in just a few places (I see five in n1570).
It seems clear that the Standard's use of this phrase is meant
to connote something different than just "pointer" by itself, and
also that this (rather rare) usage wasn't chosen by accident.  So
the rule you describe muddies the water rather than helping,
because it's not consistent with usage followed in the C standard.

The terms "pointer object" and "pointer value" are unambiguous, are they
not?  Using "pointer value" rather than "pointer" is more precise than
the standard's typical usage, but does not conflict with it.

I haven't bothered to search the standard for all uses of the word
"pointer", and I'm not planning to do so.  Apparently it's reasonably
consistent in its usage, and does not refer to objects of pointer type
as "pointers".  Rather a "pointer" is either a pointer type or an object
of pointer type, and I presume each using is clear enough in context.

The C standard does not, as far as I can tell, provide a
definition for the standalone term "pointer".  (I could have
missed something;  I checked section 3, "Terms, definitions, and
symbols", and the index.)  But the standard does, in several
places, use the term "pointer" to refer to a pointer value.  I
don't know whether it's consistent.
>
Yes, AFAICT the C standard doesn't define "pointer" as a standalone
noun.  But it is clear from context that "pointer" by itself means
basically the same thing as an address, as can be seen from the
description of unary &, in 6.5.3.2 p3, or in the second sentence
of the second paragraph of the footnote to 6.3.2.1 p1.

Sure.

Incidentally, the footnote you cited refers to an *expression* as "a
pointer".  I'm not sure that supports your point.  I can accept that the
usage in that footnote is informal.

The C standard does, however, define the word "object" to mean
a region of storage in the execution environment.  Whatever it
is that a pointer might be, it's clear that it isn't a region
of storage in the execution environment.  The idea that a pointer
object might be a pointer, rather than an object, is nonsensical
on its face, and deserves to be called out as such.

It would deserve to be called out if anyone actually suggested it.
I certainly did not.

The idea that a pointer object is a pointer "rather than an object" is
obviously wrong, and not something I suggested.  Of course a pointer
object (an object of pointer type) is an object, as I've already
explicitly said.  My suggestion was that an object of pointer type might
be informally referred to as "a pointer".  Perhaps the standard never
does so.

I get the impression that you're assuming that the word "pointer" can
*never* refer to an object of pointer type, and that clarifying the
distinction is therefore a waste of time.  Is that accurate?

I note that
<https://en.wikipedia.org/wiki/Pointer_(computer_programming)> says:

In computer science, a pointer is an object in many programming
languages that stores a memory address.

which suggests that your statement that "a pointer is not an object"
might call for some clarification, even if it's entirely consistent with
the usage in the C standard.

I'm not presenting that sentence from Wikipedia as correct.  I'm using
it to suggest that informally referring to a pointer object as "a
pointer" is common enough that it's worth mentioning the potential
ambiguity.

--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */

Date Sujet#  Auteur
29 Apr 24 * Threads across programming languages141Stefan Ram
29 Apr 24 +* Re: Threads across programming languages98Paavo Helde
29 Apr 24 i`* Re: Threads across programming languages97Lawrence D'Oliveiro
29 Apr 24 i +* Re: Threads across programming languages85Chris M. Thomasson
30 Apr 24 i i+* Re: Threads across programming languages3Lawrence D'Oliveiro
30 Apr 24 i ii`* Re: Threads across programming languages2Chris M. Thomasson
30 Apr 24 i ii `- Re: Threads across programming languages1Lawrence D'Oliveiro
1 May 24 i i`* Re: Threads across programming languages81Bonita Montero
1 May 24 i i +* Re: Threads across programming languages79Lawrence D'Oliveiro
1 May 24 i i i`* Re: Threads across programming languages78Bonita Montero
1 May 24 i i i `* Re: Threads across programming languages77Lawrence D'Oliveiro
1 May 24 i i i  +* Re: Threads across programming languages75Bonita Montero
1 May 24 i i i  i`* Re: Threads across programming languages74Lawrence D'Oliveiro
2 May 24 i i i  i +* Re: Threads across programming languages41Bonita Montero
2 May 24 i i i  i i+* Re: Threads across programming languages28David Brown
2 May 24 i i i  i ii`* Re: Threads across programming languages27Bonita Montero
3 May 24 i i i  i ii +- Re: Threads across programming languages1Lawrence D'Oliveiro
3 May 24 i i i  i ii `* Re: Threads across programming languages25David Brown
3 May 24 i i i  i ii  `* Re: Threads across programming languages24Bonita Montero
3 May 24 i i i  i ii   `* Re: Threads across programming languages23David Brown
3 May 24 i i i  i ii    `* Re: Threads across programming languages22Bonita Montero
3 May 24 i i i  i ii     `* Re: Threads across programming languages21Michael S
3 May 24 i i i  i ii      +- Re: Threads across programming languages1Bonita Montero
4 May 24 i i i  i ii      +* Re: Threads across programming languages13Lawrence D'Oliveiro
4 May 24 i i i  i ii      i`* Re: Threads across programming languages12Paavo Helde
5 May 24 i i i  i ii      i `* Re: Threads across programming languages11Lawrence D'Oliveiro
5 May 24 i i i  i ii      i  +- Re: Threads across programming languages1Paavo Helde
5 May 24 i i i  i ii      i  `* Re: Threads across programming languages9Michael S
5 May 24 i i i  i ii      i   +- Re: Threads across programming languages1Bonita Montero
13 May 24 i i i  i ii      i   `* Re: Threads across programming languages7Lawrence D'Oliveiro
13 May 24 i i i  i ii      i    +* Re: Threads across programming languages5Michael S
13 May 24 i i i  i ii      i    i+* Re: Threads across programming languages3Bonita Montero
18 May 24 i i i  i ii      i    ii`* Re: Threads across programming languages2Lawrence D'Oliveiro
22 May 24 i i i  i ii      i    ii `- Re: Threads across programming languages1Tim Rentsch
18 May 24 i i i  i ii      i    i`- Re: Threads across programming languages1Lawrence D'Oliveiro
15 May 24 i i i  i ii      i    `- Re: Threads across programming languages1Tim Rentsch
18 May 24 i i i  i ii      `* Re: Threads across programming languages6Tim Rentsch
18 May 24 i i i  i ii       `* Re: Threads across programming languages5Keith Thompson
23 May 24 i i i  i ii        `* Re: Threads across programming languages4Tim Rentsch
24 May 24 i i i  i ii         `* Re: Threads across programming languages3Keith Thompson
30 May 24 i i i  i ii          `* Re: Threads across programming languages2Malcolm McLean
30 May 24 i i i  i ii           `- Re: Threads across programming languages1Keith Thompson
3 May 24 i i i  i i`* Re: Threads across programming languages12Lawrence D'Oliveiro
3 May 24 i i i  i i `* Re: Threads across programming languages11Bonita Montero
3 May 24 i i i  i i  +* Re: Threads across programming languages2Bonita Montero
3 May 24 i i i  i i  i`- Re: Threads across programming languages1Bonita Montero
4 May 24 i i i  i i  `* Re: Threads across programming languages8Lawrence D'Oliveiro
4 May 24 i i i  i i   +* Re: Threads across programming languages3Chris M. Thomasson
4 May 24 i i i  i i   i`* Re: Threads across programming languages2Chris M. Thomasson
4 May 24 i i i  i i   i `- Re: Threads across programming languages1Chris M. Thomasson
4 May 24 i i i  i i   `* Re: Threads across programming languages4Bonita Montero
4 May 24 i i i  i i    +- Re: Threads across programming languages1Chris M. Thomasson
5 May 24 i i i  i i    `* Re: Threads across programming languages2Lawrence D'Oliveiro
5 May 24 i i i  i i     `- Re: Threads across programming languages1Chris M. Thomasson
2 May 24 i i i  i `* Re: Threads across programming languages32Chris M. Thomasson
2 May 24 i i i  i  +- Re: Threads across programming languages1Chris M. Thomasson
2 May 24 i i i  i  `* Re: Threads across programming languages30Lawrence D'Oliveiro
2 May 24 i i i  i   +* Re: Threads across programming languages9Bonita Montero
3 May 24 i i i  i   i`* Re: Threads across programming languages8Lawrence D'Oliveiro
3 May 24 i i i  i   i `* Re: Threads across programming languages7Bonita Montero
4 May 24 i i i  i   i  `* Re: Threads across programming languages6Lawrence D'Oliveiro
4 May 24 i i i  i   i   +* Re: Threads across programming languages3Chris M. Thomasson
4 May 24 i i i  i   i   i`* Re: Threads across programming languages2Lawrence D'Oliveiro
4 May 24 i i i  i   i   i `- Re: Threads across programming languages1Chris M. Thomasson
4 May 24 i i i  i   i   `* Re: Threads across programming languages2Bonita Montero
4 May 24 i i i  i   i    `- Re: Threads across programming languages1Chris M. Thomasson
2 May 24 i i i  i   `* Re: Threads across programming languages20Chris M. Thomasson
3 May 24 i i i  i    `* Re: Threads across programming languages19Lawrence D'Oliveiro
3 May 24 i i i  i     `* Re: Threads across programming languages18Chris M. Thomasson
3 May 24 i i i  i      +* Re: Threads across programming languages3Kaz Kylheku
3 May 24 i i i  i      i`* Re: Threads across programming languages2Chris M. Thomasson
3 May 24 i i i  i      i `- Re: Threads across programming languages1Chris M. Thomasson
3 May 24 i i i  i      +* Re: Threads across programming languages3Lawrence D'Oliveiro
3 May 24 i i i  i      i`* Re: Threads across programming languages2Ross Finlayson
8 May 24 i i i  i      i `- Re: Threads across programming languages1Ross Finlayson
3 May 24 i i i  i      `* Re: Threads across programming languages11David Brown
3 May 24 i i i  i       `* Re: Threads across programming languages10Michael S
3 May 24 i i i  i        `* Re: Threads across programming languages9Bonita Montero
3 May 24 i i i  i         `* Re: Threads across programming languages8Michael S
4 May 24 i i i  i          +- Re: Threads across programming languages1Lawrence D'Oliveiro
4 May 24 i i i  i          +* Re: Threads across programming languages3bart
4 May 24 i i i  i          i`* Re: Threads across programming languages2Michael S
5 May 24 i i i  i          i `- Re: Threads across programming languages1David Brown
4 May 24 i i i  i          `* Re: Threads across programming languages3Bonita Montero
4 May 24 i i i  i           +- Re: Threads across programming languages1Michael S
4 May 24 i i i  i           `- Re: Threads across programming languages1Chris M. Thomasson
1 May 24 i i i  `- Re: Threads across programming languages1Chris M. Thomasson
1 May 24 i i `- Re: Threads across programming languages1Chris M. Thomasson
1 May 24 i `* Re: Threads across programming languages11Bonita Montero
1 May 24 i  `* Re: Threads across programming languages10Lawrence D'Oliveiro
1 May 24 i   `* Re: Threads across programming languages9Bonita Montero
1 May 24 i    `* Re: Threads across programming languages8Lawrence D'Oliveiro
1 May 24 i     `* Re: Threads across programming languages7Bonita Montero
1 May 24 i      `* Re: Threads across programming languages6Lawrence D'Oliveiro
1 May 24 i       +- Re: Threads across programming languages1Michael S
2 May 24 i       +- Re: Threads across programming languages1Lawrence D'Oliveiro
2 May 24 i       `* Re: Threads across programming languages3Bonita Montero
2 May 24 i        +- Re: Threads across programming languages1Chris M. Thomasson
4 May 24 i        `- Re: Threads across programming languages1Lawrence D'Oliveiro
29 Apr 24 +* Re: Threads across programming languages19Bonita Montero
29 Apr 24 i`* Re: Threads across programming languages18Lawrence D'Oliveiro
29 Apr 24 +* Re: Threads across programming languages15Ross Finlayson
29 Apr 24 +- Re: Threads across programming languages1Chris M. Thomasson
29 Apr 24 +- Re: Threads across programming languages1Lawrence D'Oliveiro
30 Apr 24 `* Re: Threads across programming languages6Stefan Ram

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal