mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Neil Conway <neil.con...@gmail.com>
Subject Re: Review Request 58041: Don't mark a value parameter `const`.
Date Thu, 30 Mar 2017 16:09:53 GMT


> On March 30, 2017, 8:36 a.m., Benjamin Bannier wrote:
> > src/tests/fetcher_cache_tests.cpp
> > Line 410 (original), 410 (patched)
> > <https://reviews.apache.org/r/58041/diff/2/?file=1680517#file1680517line410>
> >
> >     You do not need to remove the `const` here, e.g., the following is ok,
> >     
> >         void f(int);
> >         
> >         void f(const int i) { /* cannot mutate `i` */ }
> >         
> >     This helps to avoid unintentionally mutating value parameters.
> >     
> >     It's not a pattern we follow consistently, so I'll leave it up to your own judgement.

Right, which is why I didn't try to fix it more broadly -- this particular spot seemed pretty
clear-cut as not adding value. Personally I don't think the `const` annotation adds a lot
of value for value types in function definitions in general, but we can debate that separately
if we want to institute a general rule.


- Neil


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/58041/#review170544
-----------------------------------------------------------


On March 30, 2017, 1:15 a.m., Neil Conway wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/58041/
> -----------------------------------------------------------
> 
> (Updated March 30, 2017, 1:15 a.m.)
> 
> 
> Review request for mesos and Benjamin Bannier.
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> This has no effect on the function's signature.
> 
> Spotted using the "readability-avoid-const-params-in-decls" clang-tidy
> check.
> 
> 
> Diffs
> -----
> 
>   src/tests/fetcher_cache_tests.cpp 49173af9fa1537b28784ae7543458e5b57e5180f 
> 
> 
> Diff: https://reviews.apache.org/r/58041/diff/2/
> 
> 
> Testing
> -------
> 
> `make check`
> 
> Note that we could make similar changes in more places, but I just fixed this one spot
for now.
> 
> 
> Thanks,
> 
> Neil Conway
> 
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message