Skip to main content

Thread: debug technique


hi friends!! want know debugging technique recommended. consists in put preprocessor directive indicates whether show error or not. example:

code:
#define debug 1 . . . char *c=(char*)malloc(8); #if debug == 1 if(!c) printf("error on malloc in function myfunction\n");  #endif
what want know if practice debugging program, if recommend me this. when version release, of course has compiled debug=0

thank much!!

you should check return value of malloc, may return null @ time there error - not during development.


Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk debug technique


Ubuntu

Comments