Sujet : Re: do { quit; } else { }
De : thiago.adams (at) *nospam* gmail.com (Thiago Adams)
Groupes : comp.lang.cDate : 09. May 2025, 19:23:07
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <6520b1a8-c0d7-49e8-a81a-dcc0dd9df259@gmail.com>
References : 1 2 3 4 5 6 7 8
User-Agent : Mozilla Thunderbird
Em 5/9/2025 2:45 PM, Bonita Montero escreveu:
Am 06.04.2025 um 21:53 schrieb Thiago Adams:
I have asked the same question here before. It can be implemented using macros.
>
#define try
#define catch if (0) catch_label:
#define throw do { throw_break_point(); goto catch_label;}while (0)
Exceptions make sense if you leave the scope of a single function
through an exception. Within a function this additional macro-com-
plexity isn't necessary.
I consider local jump a feature, not a limitation, especially for C because we don't have stack unwinding.
I am still using try catch macros in C, because (do quit else) cannot be used as macros, unless I use something like DO QUIT ELSE.
Apart of this problem, do { quit; } else {} and optionally do { quit; }
may be a good name for this "external jump" that I need.
The feature is pretty simple, I need a block that is on the top of for loops switch etc.. and "quit" is similar of "break" but for this top block.