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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

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