Sujet : Re: do { quit; } else { }
De : 643-408-1753 (at) *nospam* kylheku.com (Kaz Kylheku)
Groupes : comp.lang.cDate : 04. Apr 2025, 22:01:22
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20250404140041.532@kylheku.com>
References : 1 2 3
User-Agent : slrn/pre1.0.4-9 (Linux)
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/txrCygnal: Cygwin Native Application Library: http://kylheku.com/cygnalMastodon: @Kazinator@mstdn.ca