News for hackers. Stuff that matters.
Re:A Guide to Naming Variables by munificent on Friday May 13, 2016 @01:17PM (#11691700)
Call it "result":

- "val" in "retval" carries no meaning. Everything stored in a variable is a value.

- "ret" is an annoying abbreviation for "return" that makes it harder read.

- "return" focuses on an implementation detail—that the function produces its value using the language's "return" statement. It doesn't matter how the result is emitted, just that it is.

If a function is simple enough that the variable storing the result doesn't need a more specific name, "result" is a good default. You could call it "sum" here, but that shadows the function itself—a common problem for result variables—and doesn't really tell us anything we don't already know. We know we're inside a "sum" function.

Re:A Guide to Naming Variables by seanc722 on Friday May 13, 2016 @02:10PM (#11692112)
"result" was also included in the list. I honestly don't see anything wrong with either.
Re:A Guide to Naming Variables by philwelch on Friday May 13, 2016 @02:57PM (#11692453)
I usually go for "result", but that was also on OP's list. I wish it was a convention to use "r" for retval variables.
Re:A Guide to Naming Variables by vanderZwan on Saturday May 14, 2016 @03:53AM (#11695012)
Problem with that (for me) is that I use that for radius all the time, as in r * sin( a * t )