[Swan-dev] functions that sometimes assign to an argument
D. Hugh Redelmeier
hugh at mimosa.com
Wed Jan 17 20:53:19 UTC 2018
One of the hard tasks in understanding a program is to figure out who
initializes a variable.
Some of our functions take pointer arguments so that the function can set
a variable.
In many cases, the code would be easier to understand if the function
always set that variable.
An example that I've not yet understood is resolve_default_route_one. It
sometimes resolves *peer and sometimes doesn't. Who else would resolve
it? What if the results differ? It would be simpler if only one bit of
the program did that resolution.
Sometimes resolve_default_route_one is called twice with the same
arguments (if the result of the first call is 1). I think that it
will resolve *peer in both calls.
More information about the Swan-dev
mailing list