You must log in to comment.

in reply to @ThePhD's post:

RE "Comment" - I managed to get very confused by example 14 and I think it was due to the bracing - the absence of braces got me to "...wait that's 17 not 35" due to unwinding things wrong in my head. Not that I would make any guarantees that the same mistake couldn't happen to me if braces were mandated, possibly I just needed to read closer.

EXTREMELY big fan of not adding ctor/dtor to structs - frankly even in C++ I'm kind of annoyed they're in structs, I'd prefer struct had C semantics and class had C++ semantics for a very pure split between the two.

The comments section of cohost is probably not the place to write My Whole Opinion out but mainly: The primary thing I'd want to do in a dtor is call free/fclose/etc - which is fine in C++ where the members can be private so I control the necessary invariants, but in C it'd be a disaster I think. Probably a good design around it could be possible but I would not trust myself to make it.

interesting! never actually read a language proposal before but this was structured to be super readable and understandable to me c:
my only real question with is it that i don't entirely understand how control flow (goto, return) works if it skips over a defer block, i assume it doesn't execute the defer, but at some points you mention that goto-ing over a defer is "banned"? so i'm not sure if it's supposed to not execute the defer or just not compile if an attempt to goto over it is made, or is it just undefined?

i see, is that just goto? like for instance can i defer within a conditional (e.g. if ( thing ) { defer { /* stuff */ } ))? or is the assumption that defers are always static (i.e. if a defer is written in a function, it should always be executed)