Deutsch   English   Français   Italiano  
<vc1e6e$sluv$1@raubtier-asyl.eternal-september.org>

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

Path: ...!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
Subject: Re: Command line globber/tokenizer library for C?
Date: Fri, 13 Sep 2024 15:20:25 +0200
Organization: A noiseless patient Spider
Lines: 44
Message-ID: <vc1e6e$sluv$1@raubtier-asyl.eternal-september.org>
References: <lkbjchFebk9U1@mid.individual.net>
 <vbs1om$3jkch$1@raubtier-asyl.eternal-september.org>
 <vbsb94$1rsji$1@news.xmission.com>
 <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>
 <vc0iho$n8ee$2@raubtier-asyl.eternal-september.org>
 <20240913113815.0000490a@yahoo.com>
 <vc1a76$rp7k$3@raubtier-asyl.eternal-september.org>
 <20240913152500.00001863@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 13 Sep 2024 15:20:15 +0200 (CEST)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="d68882be51447eabb86122ef614d859e";
	logging-data="939999"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18Lnf6eT7I4CifOknrPF4mEvLdPyI/cgLA="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:cAByVGH0Iqwh0HqMcZj/A9e/uGg=
Content-Language: de-DE
In-Reply-To: <20240913152500.00001863@yahoo.com>
Bytes: 3303

Am 13.09.2024 um 14:25 schrieb Michael S:
> On Fri, 13 Sep 2024 14:12:32 +0200
> Bonita Montero <Bonita.Montero@gmail.com> wrote:
> 
>> Am 13.09.2024 um 10:38 schrieb Michael S:
>>> On Fri, 13 Sep 2024 07:28:34 +0200
>>> Bonita Montero <Bonita.Montero@gmail.com> wrote:
>>>    
>>>> Am 12.09.2024 um 21:38 schrieb Michael S:
>>>>   
>>>>> Callback is as easy in C as in C++.
>>>>
>>>> Absolutely not because callbacks can't have state in C.
>>>>
>>>>   
>>>
>>> So what is 'context' parameter in my code?
>>
>> In C++ the state is an own internal "this"-like object and you dont't
>> need any explicit parameters.
> 
> So, do you admit that callback in C can have state?

No, because this is a parameter and a lambda is a glue of an
object and a calling operator. The object is the state and a
C function-pointer misses that.

> Bad software engineering practice that easily leads to incomprehensible
> code.

I'm using this convention with nearly any lambda and if I can't
remember later which outer variables are used I remove the & and
the temporary non-referencing locals are underlined red and when
I've notice which locals were used I press ^Z.

> When in C++ and not in mood for C-style, I very much prefer functors.
> Ideologically they are the same as C-style context, but a little
> sugarized syntactically.

No, A C++ functor may be an object with a calling operator. In C you
don't have the implicit object; that's magnitudes less convenient. C
is always multiple times more work.