[libc++] Better std::string exception messages

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[libc++] Better std::string exception messages

Hans Wennborg via cfe-dev

Not sure if this is the right place to post stuff like this, so feel free to redirect me.

 

I’ve noticed that libc++ std::string exception messages are very basic compared to other standard libraries (eg libstdc++), with (as far as I can tell) everything throwing the exception message “basic string”.

Location where this message comes from: https://github.com/llvm-mirror/libcxx/blob/da6e915c73f231074dc88f8a952a8273da0ca06b/include/string#L609-L616

 

Example code:

int main(int argc, char** argv) {

  try {

    std::string().at(1);

  } catch (const std::out_of_range &e) {

    printf("e.what is: %s\n", e.what());

  }

}

 

-stdlib=libc++: e.what is: basic_string

-stdlib=libstdc++: e.what is: basic_string::at: __n (which is 1) >= this->size() (which is 0)

 

Tim


_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: [libc++] Better std::string exception messages

Hans Wennborg via cfe-dev

Forwarding this to libcxx-dev (moving cfe-dev to BCC)

 

From: cfe-dev <[hidden email]> on behalf of cfe-dev <[hidden email]>
Reply-To: LANDER Tim <[hidden email]>
Date: Wednesday, January 29, 2020 at 11:11 PM
To: cfe-dev <[hidden email]>
Subject: [cfe-dev] [libc++] Better std::string exception messages

 

Not sure if this is the right place to post stuff like this, so feel free to redirect me.

 

I’ve noticed that libc++ std::string exception messages are very basic compared to other standard libraries (eg libstdc++), with (as far as I can tell) everything throwing the exception message “basic string”.

Location where this message comes from: https://github.com/llvm-mirror/libcxx/blob/da6e915c73f231074dc88f8a952a8273da0ca06b/include/string#L609-L616

 

Example code:

int main(int argc, char** argv) {

  try {

    std::string().at(1);

  } catch (const std::out_of_range &e) {

    printf("e.what is: %s\n", e.what());

  }

}

 

-stdlib=libc++: e.what is: basic_string

-stdlib=libstdc++: e.what is: basic_string::at: __n (which is 1) >= this->size() (which is 0)

 

Tim


_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev