What type should I catch if I throw a string literal?

后端 未结 7 835
南笙
南笙 2020-12-05 18:11

I am writing a pretty simple application in C++ using g++ under Linux and I am trying to throw some raw strings as exceptions (yes, I know, its not a good practise).

相关标签:
7条回答
  • 2020-12-05 19:01

    Try adding const to the types you're catching, const char* (possibly const char* const).

    0 讨论(0)
提交回复
热议问题