3

I have searched, but cannot find how (or if) I can step over or continue after a c assert() in xcode 4/ios 5.0. I am using c++ not objective-c. Will I need to define my own assert to achieve this?

Thanks~

ashleysmithgpu
  • 1,867
  • 20
  • 39

3 Answers3

1

Asserts aren't normally meant to be ignored. They are there for the programmer to communicate to other programmers that "this should never, ever happen". If you're curious to see what happens if you continue past the assert, comment it out and see how your program behaves after the point where it would normally fail.

Paul Manta
  • 30,618
  • 31
  • 128
  • 208
0

The purpose of assert()s is to stop execution (and/or throw you into a debugger) when the condition being asserted is false. As such, it is not wanted to "just continue" after an assert, as it indicates a violation of some precondition/invariant that will invariably lead to Bad Things (tm) later on.

PlasmaHH
  • 15,673
  • 5
  • 44
  • 57
0

"assert(expr)" is just a short form for (NDEBUG being undefined) "if (expr == 0) abort();". Maybe this is a better way (without abort()) than using assert.

ott--
  • 5,642
  • 4
  • 24
  • 27