Deutsch   English   Français   Italiano  
<vc9ols$2v5hb$2@raubtier-asyl.eternal-september.org>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!2.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail
From: Bonita Montero <Bonita.Montero@gmail.com>
Newsgroups: comp.lang.c++,alt.comp.lang.c++.misc
Subject: Re: Counting Characters!!
Date: Mon, 16 Sep 2024 19:08:14 +0200
Organization: A noiseless patient Spider
Lines: 29
Message-ID: <vc9ols$2v5hb$2@raubtier-asyl.eternal-september.org>
References: <vc34i0$3rnbg$1@paganini.bofh.team> <vc4oti$1kk40$5@dont-email.me>
 <vc9kck$2u6ef$1@raubtier-asyl.eternal-september.org>
 <vc9l5e$2ue0d$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 16 Sep 2024 19:08:12 +0200 (CEST)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="7f2e19ea611e8f4c2d249d670ad653d4";
	logging-data="3118635"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+uw/ccz8Nw2nPZXJGfeqgSA+8n8LI1+uw="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:UkLDEuZTe/KK9XmbG8xe5pdsykc=
In-Reply-To: <vc9l5e$2ue0d$1@dont-email.me>
Content-Language: de-DE
Bytes: 2062

Am 16.09.2024 um 18:08 schrieb Muttley@dastardlyhq.com:
> On Mon, 16 Sep 2024 17:55:02 +0200
> Bonita Montero <Bonita.Montero@gmail.com> boringly babbled:
>> Am 14.09.2024 um 21:41 schrieb Chris Ahlstrom:
>>> DMZ wrote this copyrighted missive and expects royalties:
>>>
>>>> This simple program will count characters for you!!
>>>>
>>>> #include <stdio.h>
>>>>
>>>> int main()
>>>> {
>>>>        printf(" = %d characters", printf("Hello World!"));
>>>>
>>>>        return 0;
>>>> }
>>>
>>> Cute.
>>>
>>
>> Nice, but this counts the characters at compile-time:
>>
>> 	std::string_view sv( "Hello World!" );
>> 	std::cout << sv << " = " << sv.length() << " characters" << endl;
> 
> So does sizeof("Hello world!");
> 

But sizeof(string_literal) includes the null-terminating character.