Deutsch   English   Français   Italiano  
<slrnvvased.ejp.candycanearter07@candydeb.host.invalid>

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

Path: ...!news.misty.com!weretis.net!feeder9.news.weretis.net!news.quux.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: candycanearter07 <candycanearter07@candycanearter07.nomail.afraid>
Newsgroups: comp.lang.c
Subject: Re: do { quit; } else { }
Date: Tue, 8 Apr 2025 19:00:04 -0000 (UTC)
Organization: the-candyden-of-code
Lines: 69
Message-ID: <slrnvvased.ejp.candycanearter07@candydeb.host.invalid>
References: <vspbjh$8dvd$1@dont-email.me> <20250404132935.60@kylheku.com>
 <20250404133502.695@kylheku.com>
Injection-Date: Tue, 08 Apr 2025 21:00:04 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="fa2a23ad082c7388cada7dbc42e5fdf8";
	logging-data="3022100"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1868OghQ54XCzhV5MfZburpOOwp6lIb5pior0Imtk0wMA=="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:JIqiyKkAdlFO+5mTlp/TTGnngXQ=
X-Face: b{dPmN&%4|lEo,wUO\"KLEOu5N_br(N2Yuc5/qcR5i>9-!^e\.Tw9?/m0}/~:UOM:Zf]%
 b+ V4R8q|QiU/R8\|G\WpC`-s?=)\fbtNc&=/a3a)r7xbRI]Vl)r<%PTriJ3pGpl_/B6!8pe\btzx
 `~R! r3.0#lHRE+^Gro0[cjsban'vZ#j7,?I/tHk{s=TFJ:H?~=]`O*~3ZX`qik`b:.gVIc-[$t/e
 ZrQsWJ >|l^I_[pbsIqwoz.WGA]<D
Bytes: 2925

Kaz Kylheku <643-408-1753@kylheku.com> wrote at 20:39 this Friday (GMT):
> On 2025-04-04, Kaz Kylheku <643-408-1753@kylheku.com> wrote:
>> On 2025-04-04, Thiago Adams <thiago.adams@gmail.com> wrote:
>>>    What do you think of this control block?
>>>
>>>    do
>>>    {
>>>       FILE f = fopen("file.txt", "r");
>>>
>>>       if (f == NULL) quit; /*goes to else part*/
>>>
>>>       /*success here*/
>>>       for (int i =0; i < 10; i++){
>>>           ...
>>>           if (error) quit;
>>>       }
>>>
>>>    }
>>>    else
>>>    {
>>>       /*some error*/
>>>    }
>>
>>
>> The else part might need access to some local variables
>> in the main part.
>>
>>   do {
>>      char *name = calculate_path(PATH_PREFIX "/", name, ".txt");
>>      FILE *f = fopen(...)
>>
>>      if (!f)
>>        quit;
>>      ...
>>   }
>>   else
>>   {
>>      printf("unable to open %s\n", name);
>>      ...
>>   }
>>
>> If you make that work, you're creating scope wormholes between
>> disjoint curly braces, which is not allowed if youre name isn't
>> Bjarne Stroustrup.
>
> How about: do/else if/else if/else with argument passing to first
> clause whose signature can take the argument list:
>
>  do {
>    ...
>    quit("rage"); // goes to (char *arg)
>    ...
>    quit(42);     // goes to (int arg)
>    ...
>  }
>  else if (char *arg)  // or just else? multiple elses on do, why not.
>  {
>  }
>  else (int arg)
>  {
>  }
>
> Friday `f`noons, eh?


I believe that's how python try/except works, with different error
types.
-- 
user <candycane> is generated from /dev/urandom