Jump to content
pan

int functions behaving like void functions

Recommended Posts

Hello, lately I was reading Hercules' source-code and I've noticed that there are many functions that are defined as 'int' types but are constant, they're returning only one value. Look for instance at pc_bonus it returns 0 in all possible inputs...

I guess that functions like this should return whether they were successful or not, otherwise there's no way to handle exceptions like if there was an incorrect input. For instance pc_bonus should be defined as 'bool' instead of 'int' and return whether it was successful or not, I'm sure that there're many functions that are defined "incorrectly" as well.

 

Hope I've helped,

Pan.

Share this post


Link to post
Share on other sites

yup, there are also many whose return value is irrelevant (e.g. timers), we haven't prioritised this kind of cleanup though (we usually fix those we pass by)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.