Bjartensen / root-clustering-focalh

0 stars 0 forks source link

When/if to use boolean functions and switching to exceptions #17

Open Bjartensen opened 5 months ago

Bjartensen commented 5 months ago

I have a (bad) habit of making every function bool and instead of returning variables I use non-const references.

I like it because if most of my functions are bool I can at all steps say

if (!some_func(&a,&b...)) return false;

to exit nicely out of functions.

It looks nice but I fear it's bad practice. If I want to keep the checking functionality I should perhaps switch to try/catch.

Bjartensen commented 5 months ago

Some of my bool functions are vacuous as well -- always returning true at the moment.