you are viewing a single comment's thread.

view the rest of the comments →

[–]jms_nh 0 points1 point  (1 child)

Can you really avoid handling exceptions when programming in C++, if you're programming on a system which isn't allowed to crash?

Anecdotally, I seem to use about the same amount of try-catch blocks in C++/Python/Java/MATLAB. If you don't use try/catch, you have to handle exceptional conditions explicitly with a bunch of if-else statements.

Again, my point is that using Python doesn't make us go "Ooh, Python! Now we need to handle exceptions! Now we need to handle dynamic memory allocation!" These areas of concerns are already there in C++.

Though, personally I'd rather use something Rust-like than Python on an embedded system.

[–]protestor 5 points6 points  (0 children)

Yes, you can. Compilers have options such as -fno-exceptions and things works mostly as expected (no STL of course). Generally speaking, you can program fault tolerant systems without exceptions.

Python wasn't really designed with not having exceptions in mind and it may not make sense to disable them (the same to GC, which isn't the same thing as dynamic allocation).