top | item 41167342

(no title)

terrymah | 1 year ago

Nah that was mostly about extern "C" functions which technically can't throw (so the noexcept runtime stuff would be optimized out) but in practice there is a ton of code marked extern "C" which throws

discuss

order

Arech|1 year ago

> in practice there is a ton of code marked extern "C" which throws

Obviously, a random programmer could do any evil things, but does that apply to standard code, such as C standard library used from C++?

leni536|1 year ago

Yes, qsort and bsearch can throw.

dataflow|1 year ago

extern "C" seems related to the other flags, not 'r'?

terrymah|1 year ago

Well, yeah, things can be related to many things, but throwing extern "C"s was one of the motivations as I recall for 'r'. r is about a compiler optimization where we elide the runtime terminate check if we can statically "prove" a function can never throw. To prove it statically we depend on things like extern "C" functions not throwing, even though users can (and do) totally write that code.