How to avoid returning NULL on error if it has to return something? (in C) -


i've stumbled on articles here , here, says programming practice never return null. functions need return something, should return? value of -1 not going cut since lets have function:

char *return_some_string(int input) {     /* */      if (error)          return some_thing_not_null;  } 

how round problem?

i've stumbled on articles says programming practice never return null.

unconditionally stating shows quality of article. burn it.

but functions need return something, should return?

null. conceptually, that's "invalid pointer", "pointer points nothing", whatever. there's reason it's in language.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -