| Deutsch English Français Italiano |
|
<20250404140041.532@kylheku.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: Kaz Kylheku <643-408-1753@kylheku.com>
Newsgroups: comp.lang.c
Subject: Re: do { quit; } else { }
Date: Fri, 4 Apr 2025 21:01:22 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 28
Message-ID: <20250404140041.532@kylheku.com>
References: <vspbjh$8dvd$1@dont-email.me> <20250404132935.60@kylheku.com>
<vspfv7$ce6m$2@dont-email.me>
Injection-Date: Fri, 04 Apr 2025 23:01:22 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="0acdb8a9a9b6b4fb3b99d09777fb4d36";
logging-data="480410"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18YeWalaN1pq8BjxDsh401uXIUbz+6UXaY="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:U+5+H+UflZqNy/zC8gAGsBXiwuY=
Bytes: 1694
On 2025-04-04, Thiago Adams <thiago.adams@gmail.com> wrote:
> Em 4/4/2025 5:34 PM, Kaz Kylheku escreveu:
>> 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);
>> ...
>> }
>
> In this case we move the scope of the variable we need.
Your name isn't Bjarne Stroustrup, so you're not allowed to
create scope wormholes between disjoint curly braces.
--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca