Re: Implicit String-Literal Concatenation

Liste des GroupesRevenir à cl c  
Sujet : Re: Implicit String-Literal Concatenation
De : Keith.S.Thompson+u (at) *nospam* gmail.com (Keith Thompson)
Groupes : comp.lang.c
Date : 08. Mar 2024, 00:16:41
Autres entêtes
Organisation : None to speak of
Message-ID : <87sf11ofg6.fsf@nosuchdomain.example.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
User-Agent : Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Lawrence D'Oliveiro <ldo@nz.invalid> writes:
On Mon, 04 Mar 2024 20:55:28 -0800, Keith Thompson wrote:
Lawrence D'Oliveiro <ldo@nz.invalid> writes:
On Thu, 29 Feb 2024 14:14:52 -0800, Keith Thompson wrote:
"A *string* is a contiguous sequence of characters terminated by and
including the first null character."
>
So how come strlen(3) does not include the null?
 Because the *length of a string* is by definition "the number of bytes
preceding the null character".
>
So the “string” itself includes the null character, but its “length” does not?
Yes, as you can easily see if you read 7.1.1p1 for yourself.
I can't tell if you're trying to understand C strings, or you're
suprised by how they're defined, or you object to how they're defined,
or you don't accept how they're defined, or something else.  I'm getting
the impression that you're arguing for the sake of arguing, but perhaps
that's unfair of me.  If you have a wider point, perhaps you could let
us know what it is.
I'll also note that you asked why strlen() doesn't include the null, I
answered, and you snipped most of my answer.  Of course there's usually
no need to quote all of an article you're replying to, but it would be
helpful if you'd mark your deletions.  (I usually use "[...]".)  You've
given the impression that I gave you just a one-sentence answer to your
question, which is not the case.
--
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 */

Date Sujet#  Auteur
7 Mar 24 * Re: Implicit String-Literal Concatenation8Lawrence D'Oliveiro
7 Mar 24 +* Re: Implicit String-Literal Concatenation6Kaz Kylheku
8 Mar 24 i`* Re: Implicit String-Literal Concatenation5Keith Thompson
8 Mar 24 i +* Re: Implicit String-Literal Concatenation2Kaz Kylheku
8 Mar 24 i i`- Re: Implicit String-Literal Concatenation1Keith Thompson
8 Mar 24 i +- Re: Implicit String-Literal Concatenation1Chris M. Thomasson
8 Mar 24 i `- Re: Implicit String-Literal Concatenation1Richard Harnden
8 Mar 24 `- Re: Implicit String-Literal Concatenation1Keith Thompson

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal