Method types and return values handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

34 Jerusalem rd. Ra'anana, 43501

bsasonro@redhat.com    T: +972-9-7692304
M: +972-52-4326355

_______________________________________________

Community Meeting Calendar:

APAC Schedule -
Every 2nd and 4th Tuesday at 11:30 AM IST
Bridge: https://bluejeans.com/441850968


NA/EMEA Schedule -
Every 1st and 3rd Tuesday at 01:00 PM EDT
Bridge: https://bluejeans.com/441850968

Gluster-devel mailing list
Gluster-devel@xxxxxxxxxxx
https://lists.gluster.org/mailman/listinfo/gluster-devel


[Index of Archives]     [Gluster Users]     [Ceph Users]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux