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

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

Path: ...!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: Command line globber/tokenizer library for C?
Date: Wed, 18 Sep 2024 10:49:38 +0100
Organization: A noiseless patient Spider
Lines: 41
Message-ID: <vce7nh$tdc$1@dont-email.me>
References: <lkbjchFebk9U1@mid.individual.net>
 <vbsmlb$3o6n2$1@raubtier-asyl.eternal-september.org>
 <vbsu1d$3p7pp$1@dont-email.me>
 <vbtj88$1kpm$1@raubtier-asyl.eternal-september.org>
 <vbujak$733i$3@dont-email.me> <vbum9i$8h2o$1@dont-email.me>
 <vbur72$99cr$1@dont-email.me> <20240912181625.00006e68@yahoo.com>
 <vbv4ra$b0hv$2@dont-email.me>
 <vbv6r1$bhc9$1@raubtier-asyl.eternal-september.org>
 <20240912223828.00005c10@yahoo.com> <861q1nfsjz.fsf@linuxsc.com>
 <20240915122211.000058b1@yahoo.com> <vcd05n$q3mn$1@paganini.bofh.team>
 <20240918024611.000002f3@yahoo.com> <vcd5jk$3oe5h$1@dont-email.me>
 <20240918114305.00002317@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 18 Sep 2024 11:49:38 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="521c9b697fde59071240119733a6c915";
	logging-data="30124"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+v1UibUdSyWzLrzUdWmVYb"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:bXnrJQoLks3X6RrlfEs8SsTIll8=
Content-Language: en-GB
In-Reply-To: <20240918114305.00002317@yahoo.com>
Bytes: 2871

On 18/09/2024 09:43, Michael S wrote:
> On Wed, 18 Sep 2024 01:07:17 +0100
> Bart <bc@freeuk.com> wrote:

>> I find such a coding style pretty much impossible to grasp and
>> unpleasant to look at. I had to refactor it like this:
>>
>> ---------------
>>
>> static_Bool collect_word(char *s, char *r, _Bool w, Gopher go ) {
>>       char c = *s;
>>       #if 1
>>           if (c == 0) {
>>               go->f(go, r, s);
>>               return  w;
>>           }
>>           if (is_space(c) && w) {
>>               go->f(go, r, s);
>>               return words_do(s, go);
>>           }
>>           return collect_word(s+1, r, (w ^ c) == '"', go);
> 
> That's not how it was written in original. Should be:
>           return collect_word(s+1, r, w ^ c == '"', go);
> Not the same thing at all.

So, what you are saying is that it means 'w ^ (c == '"')'? Because there 
could be some ambiguity, I put in the brackets. I had to to guess the 
precedence and chose the one that seemed more plausible, but I guessed 
wrong.

Mine version then should be:

       return collect_word(s+1, r, w ^ (c == '"'), go);


> The same here.

I'm surprised there weren't more typos, but that's not what my post was 
about which was presentation and layout.