Was return(0) important?

 

Just a curiosity question more than anything, since I deleted most of the return(0)s in the old build with no ill effects.

The new 600 build debugger keeps telling me off if I accidentally copy and paste return(0); into the void OnTick section.

My solution was to delete return(0).

 

Functions with return type void do not or must not return a type.

 

If you need a return to exit the void type function you can use return; without parenthesis.

 
eempc:

Just a curiosity question more than anything, since I deleted most of the return(0)s in the old build with no ill effects.

The new 600 build debugger keeps telling me off if I accidentally copy and paste return(0); into the void OnTick section.

My solution was to delete return(0).

  1. The old builds was int start(){} so a return(0); was appropriate. The actual value was ignored so simply falling off the end brace was fine.
  2. The new build is void OnTick(){} so a return(anything); is wrong. Either return; or just fall off the end brace.
 

"A return operator terminates the current function execution and returns the control to the calling program. A return(expression); operator terminates the current function execution with result transmission. The operator expression must be enclosed in parentheses and should not contain an assignment operator."

The above is not exactly the most newbie-comprehensible language to read. If I understand it correctly, the point of return/return(0) is to terminate the EA for the current tick. And then, when the next tick arrives, everything inside int start(){} starts all over again until it hits another return?

So now that I am transferring my old code to the 600 build, I still need to include a return; at the very end?

Edit: nevermind, I read now that I can just let the code fall off the end brace without a final return.

Reason: