Deutsch   English   Français   Italiano  
<v3ngs9$gksq$1@dont-email.me>

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

Path: ...!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: bart <bc@freeuk.com>
Newsgroups: comp.lang.c
Subject: Re: Interval Comparisons
Date: Tue, 4 Jun 2024 17:54:33 +0100
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <v3ngs9$gksq$1@dont-email.me>
References: <v3merq$b1uj$1@dont-email.me> <v3ml0d$bpds$5@dont-email.me>
 <v3mlrb$c7d5$1@dont-email.me> <v3ms7b$d5sq$1@dont-email.me>
 <v3mtf2$ct28$2@dont-email.me> <v3n4is$emdc$1@dont-email.me>
 <DnG7O.8145$_US6.7552@fx44.iad> <v3ndji$fv12$1@dont-email.me>
 <20240604192547.00003fbd@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 04 Jun 2024 18:54:34 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="027492d54fa7a72a30fd705d730c9473";
	logging-data="545690"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1++wH/JSazaNyTDvdILS6BT"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:UOOxY3ldxPpEc5GrvKHWuD+aOxk=
In-Reply-To: <20240604192547.00003fbd@yahoo.com>
Content-Language: en-GB
Bytes: 2212

On 04/06/2024 17:25, Michael S wrote:
> On Tue, 4 Jun 2024 16:58:43 +0100
> bart <bc@freeuk.com> wrote:
> 
>> On 04/06/2024 16:27, Scott Lurndal wrote:
>>> David Brown <david.brown@hesbynett.no> writes:
>>>> On 04/06/2024 13:23, bart wrote:
>>>    
>>>>> It is incredibly useful:
>>>>>
>>>>>       if c in [' ', '\t', '\n'] then ... # whitespace
>>>
>>> if (strpbrk(c, " \t\n") != NULL) it_is_whitespace.
>>
>> That doesn't do the same thing. In my example, c is a character, not
>> a string.
>>
> 
> 
> Will that be be better?
> if (memchr(" \t\n", c, 3) != NULL)
> 

It's a better match. But on gcc-O3, it still calls the library function 
up to version 12.x. After that, it's smart enough to generate similar 
code to my non-optimising compiler using the built-in feature.

It is also still limited to byte values.

My approach is to fix a language, which is easier, than to expend 
magnitudes more effort in elaborate tools and ultra-smart compilers.