[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Review of sizeof usage

From: Stefan Fuhrmann <stefan.fuhrmann_at_wandisco.com>
Date: Thu, 13 Aug 2015 14:18:07 +0100

On Thu, Aug 13, 2015 at 11:17 AM, Philip Martin <philip.martin_at_wandisco.com>
wrote:

> Stefan Fuhrmann <stefan.fuhrmann_at_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.
Received on 2015-08-13 17:31:51 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.