Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

English style conventions for standard C++ exception messages

I'm asking about the strings returned by the what method of exceptions thrown by the standard library.
Do they usually start with a capital letter or a lowercase letter?
Do they usually end with a punctuation mark?

Is there any kind of convention for this that at least most standard library implementations adhere to?

like image 828
Corvus Corax Avatar asked Oct 24 '25 22:10

Corvus Corax


2 Answers

Absolutely none. The exception message is basically irrelevant anyway and contains no useful information- same as the raw exception objects. Pretty much the only useful information is "An exception was thrown".

like image 114
Puppy Avatar answered Oct 26 '25 11:10

Puppy


In general, I'll agree with the previous comments and answer, with one exception (pun intended). If you are are developing under a controlled quality system, your coding standard may stipulate how exceptions are reported. As an example, the FDA refers to "coding guidelines" for medical device software development. IEC 62304 more explicitly states the need for a software development process to rely on coding standards. So, on the contrary, someone may indeed care.

Having said that, it's interesting to note that the JSF C++ coding standard forbids exceptions (see p. 59), and Google's coding standard forbids them, as well.

like image 31
Throwback1986 Avatar answered Oct 26 '25 11:10

Throwback1986



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!