Re: [RFC PATCH 1/9] rebase -i: only write fixup-message when it's needed

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

 



Charvi Mendiratta <charvi077@xxxxxxxxx> writes:

> Okay, I looked into the write_message(...) and agree that it does not return
> a positive value and only returns non-zero for error case and zero for
> success. So, for this patch maybe we can ignore checking '< 0' here and
> later add another patch to make this function follow the convention of
> "negative is error".

Please don't.  There is a higher cognitive cost to readers when you write

	if (write_message(...)) {

The reader is forced to look at its implementation to see if it
returns positive in a non-error situation.

If you write it like so from the beginning

	if (write_message(...) < 0) {

the reader can trust that the code follows "negative is an error"
convention.  One fewer thing readers have to worry about.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux