4 ms·
Thanks for the tips, I'll apply them. Just a couple questions: * Do you have a link about the _ (underscore) being forbidden? Our current coding rule make us
by loup-vaillant 11y ago
Thanks for the tips, I'll apply them. Just a couple questions:
* Do you have a link about the _ (underscore) being forbidden? Our current coding rule make us use them right now.
* Is there a standard exception object I could throw? If I could just write something like `throw std::invalid_argument("what String");` that would be terrific. I don't want to construct a whole class just for that. (Maybe I have to, though?)
I'll also seriously consider boost. While it's a huge dependency, we are on Debian GNU/Linux, so it's probably not that bad.
- blub 11y agoYou're welcome. The underscore thing is mentioned in 17.6.4.3.2 Global names, however it's more complex than what I said initially (this is C++ after all): * double underscore or underscore + capital letter is reserved in any scope * underscore is reserved in global scope Your code is allowed in fact, sorry. My personal rule is that I never start an identifier with an underscore anywhere.
- blub 11y agoI missed the exc question: yes, invalid_argument is perfectly acceptable in my opinion. However, if you want to inherit from invalid_arg that is also possible - this would allow you to catch only this very specific type of error.