Re: [PATCH v2] stash: pass pathspec as pointer

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

 



Thomas Gummerer <t.gummerer@xxxxxxxxx> writes:

>> I see that you added the `const` keyword. While it does not hurt, I would
>> probably not have bothered...
>
> That's fair, I went with what seemed most common in the codebase.
> More than half the parameters seem to be using "const struct
> pathspec", so that seems to be the more common way if we don't require
> the parameter to be modifyable.

Yes, when you prepare a struct at a callsite and pass it thru a long
callchain, it is very helpful to both humans and compilers reading
the code to declare that the structure would not be modified, if the
code indeed keeps it constant.  A caller that used to passed the
structure by value certainly hasn't been expecting the callee would
modify its contents and it needs to read back the updated value, so
I find that most of these constifing, if not all, very much in line
with the original's spirit.



[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