• C

try-catch - c language

Hi,

Is there try catch feature in objective c? I am doing some code and it is very difficult to get exact reason of error. Like in try -catch, we can get exact error in catch.

Please let me know if there is try-catch and how to implement it? If it is not then how can I catch exact error?

Thanks
Johny12345Asked:
Who is Participating?
 
sarabandeCommented:
note, you would not get an exception in case of a segmentation fault, means on pointer errors.  you could write  a signal handler which handles those errors and turns them to a NSException. but as far as I know that would not prevent your program from hanging because the code (normally) could not recover from such kind of errors.  

Sara
0
 
tigin44Commented:
you can find an example of try catch usage in objective c


http://stackoverflow.com/questions/3363612/try-catch-block-in-objective-c
0
 
stefan73Commented:
@Sara: depends - at least the code could print a stack trace in such a case, or at least try to do so. If the logging modulel itself is affected, this won't work.
0
 
Johny12345Author Commented:
thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.