int functions behaving like void functions

pan

Community Contributors
Messages
355
Points
0
Github
panikon
Emulator
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.

 
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)

 
  • Upvote
Reactions: pan
Back
Top