[lldb-dev] LLDB Evolution - Final Form
Sean Callanan via lldb-dev
lldb-dev at lists.llvm.org
Tue Sep 20 13:55:46 PDT 2016
My 2¢:
> assert(p);
> int x = *p;
> …
> assert(ptr);
> int x = strlen(ptr);
Both of these should either check for null, be in a situation where p is obviously good (e.g., p is data() from a stack-allocated std::vector), or use references. The assertion to my mind is like an admission "I'm not 100% sure, so let me crash if I'm wrong..." – if we're making that admission and not doing error handling, we're already a little shady.
Sean
More information about the lldb-dev
mailing list