Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This is an interesting post, definitely! However, as it was posted in 2012 I feel like some of his concerns have been addressed in newer versions of C++.

Instead of having a Constructor + init method you could have a static create function which returns an optional or a pair.

I have a hard time seeing in what case you would want to throw in a destructor though? Maybe I'm just writing a different kind of code :)



> I have a hard time seeing in what case you would want to throw in a destructor though? Maybe I'm just writing a different kind of code :)

I can't imagine that case either - but what I can imagine is that your destructor calls a function that calls a function ... that calls a function you didn't realize can throw.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: