Sujet : Re: encapsulating directory operations
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.lang.cDate : 09. Jun 2025, 08:59:05
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <1026489$e1bd$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
User-Agent : Pan/0.162 (Pokrosvk)
On Sun, 8 Jun 2025 10:06:58 +0200, Bonita Montero wrote:
In C every call level has to deal with erorrs, whereas in C++ only
one level at the upper edge has to catch the errors.
Not necessarily that simple. It might be easier if C++ had
try/finally (like Python does), but it doesn’t.
Here’s a patch I submitted to the Blender project some years ago to
fix up their directory-scan code to gracefully recover from errors
without either memory leaks or double-frees. This code is in C. It’s
all a matter of structured programming.
<
https://projects.blender.org/blender/blender/src/commit/edf4855a38e3ee24874431f7c6321f04cb6d1b2f>