subversion-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Fuhrmann <stefan.fuhrm...@wandisco.com>
Subject Re: Review of sizeof usage
Date Thu, 13 Aug 2015 13:18:07 GMT
On Thu, Aug 13, 2015 at 11:17 AM, Philip Martin <philip.martin@wandisco.com>
wrote:

> Stefan Fuhrmann <stefan.fuhrmann@wandisco.com> writes:
>
> >> I prefer the explicit type as it is easier to grep.
> >
> > What do you grep for, specifically? The type should
> > already show up for the variable / function argument
> > declaration - so, you should not miss a type usage
> > either way.
>
> If I want to find all the locations that a given type is allocated then
> using grep is hard on code like this:
>
>     type_t *p;
>     ...
>     p = apr_palloc(result_pool, *p);
>
> and this:
>
>     void foo(type_t **p, apr_pool_t *pool)
>     {
>        *p = apr_palloc(pool, **p);
>     }
>
> Finding sizeof(type_t) is easier.
>

So, changing apr_hash_get/set calls and allocations
where the type is specified on the same line to the
variable-based variant would not affect that use-case.

This would already cover half of the places where we
currently use explicit types. Is changing those o.k.
with you?

-- Stefan^2.

Mime
View raw message