[Gluster-devel] Method types and return values handling
Barak Sason Rofman
bsasonro at redhat.com
Thu Dec 19 14:35:05 UTC 2019
Hello everyone,
I'd like to bring some points up for discussion:
1 - We have a great number of methods all across Gluster which (for
example) are declared to be 'int' but in reality return (for example) 0 in
all cases, both on the positive and the negative path.
2 - In many cases there are calls to methods that return a value, but this
value is completely ignored (e.g. the method 'foo(...)' return an int, but
all calls are in the form of 'foo(...)' instead of ret = 'foo(...)' ).
These 2 issues adversely affects the readability/maintainability of the
project and probably also affect error handling (if an error occurs in a
method that always returns 0, how will the calling methods know that an
error happened?).
These issues are not specific to a certain component, but seem to be all
across the project.
I believe this needs addressing, and probably in one of the following ways:
1 - Change methods to 'void', where there is really no need for a return
value.
2 - Actually handle the return value and log erros accordingly.
Of course discretion is needed and in some cases we could change to void,
while in other handle the return value.
I'd like to hear opinions on if and how this needs to be handled.
Thank you all.
--
*Barak Sason Rofman*
Gluster Storage Development
Red Hat Israel <https://www.redhat.com/>
34 Jerusalem rd. Ra'anana, 43501
bsasonro at redhat.com <adi at redhat.com> T: *+972-9-7692304*
M: *+972-52-4326355*
<https://red.ht/sig>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gluster.org/pipermail/gluster-devel/attachments/20191219/d7fa7185/attachment.html>
More information about the Gluster-devel
mailing list