Liste des Groupes | Revenir à cl c |
Em 5/9/2025 2:45 PM, Bonita Montero escreveu:One problem with the "do { quit; } else {}" syntax might be that, when the parser encounters "quit", it doesn't yet know whether it is part of a "do { } while" or a "do { } else" construct.Am 06.04.2025 um 21:53 schrieb Thiago Adams:I consider local jump a feature, not a limitation, especially for C because we don't have stack unwinding.
>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 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.
Les messages affichés proviennent d'usenet.