[OT] - C++ exceptions are becoming more and more problematic

meta meta at gmail.com
Fri Feb 25 04:09:51 UTC 2022


On Friday, 25 February 2022 at 00:30:49 UTC, H. S. Teoh wrote:
> Nobody has yet answered my initial question about whether D's 
> exception throwing mechanism holds a global lock, which is the 
> primary issue identified in the OP's linked article.  Until 
> this question is answered, all this talk about exceptions being 
> bad for multi cores is just beating a strawman.  It's 
> tantamount to saying, since the global lock in C++ exceptions 
> causes performance problems, exceptions must therefore be bad 
> (even when no global lock exists).  It's a non sequitur.  The 
> problem observed in the article is caused by the global lock, 
> not by exceptions per se.  (And whether exceptions in and of 
> themselves necessitate a global lock has not yet been 
> established.)

I don't even think the global lock is the only issue, to begin 
with..

And, no matter what, it's a double penalty in D because it is a 
Heap allocation, and that can pause all the threads if it 
requires more memory.. due to the use of a GC

To counter that, one suggested the use of RC, or a value.. but 
even then, we still deal with exceptions!

No matter what, I personally stopped using exception altogether 
in my C++ projects, and moving forward, in my new D projects too


Also I don't think it is wise to design, or hold designs of, the 
language because you expect people to be lazy, we should have 
design philosophy based on HW and Software constrains, not based 
on lazyness/sloppyness of some developers.. we'll attract the 
wrong user base.. and even then it'll be hard to compete with 
sloppy dynamic languages out there... javascript... to name a few

We should all handle our errors and maintain healthy codebases 
that are safe and make software great again!



More information about the Digitalmars-d mailing list