Return codes for standard functions?

 

One area that is not clear in the book or documentation is what the return codes should be from init(), deinit() and start() under the condition of success and failure?

Should we always return 0 from these?

 

no, you can do this, for instance.

#define ERROR -1

int init()
  {
//----
  int w_handle = WindowHandle(Symbol(),0);
  if(w_handle <= 0) return(ERROR);  
  
  return(w_handle);
//----
  }

int start()
  {
//----
  if(init() == ERROR)   return(0);
  else  
     {
      // ...do something..   
     Comment(init());
     }
//----
   return(0);
  }
 
stewart:
One area that is not clear in the book or documentation is what the return codes should be from init(), deinit() and start() under the condition of success and failure?
The value returned is not used by the terminal, so EVERY example in the book used return(0);
 
Many thanks all. I will continue to use return(0) for init(), start(0) and deinit().