Exception Exception Exception :: what () is standardized for standard exceptions?

For standardized exceptions, such as std::bad_alloc, should the string returned exception::what()be the same for all compilers?

For example, several compilers with which I worked with all return bad allocationfor bad_alloc::what(). Is there a reason why a more descriptive string, such as Memory allocation failure, is not returned?

+4
source share
2 answers

Is the string returned exception::what()is the same for all compilers?

No, this is not standardized.

Your example bad_alloc:

[C++11: 18.6.2.1/5]: virtual const char* what() const noexcept;

Returns: NTBS with specific implementation.

(NTBS "- ", " ", .)

.


- , , , ?

, , . , " ", ; , , , .

+3

, ++.

0

All Articles