[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: Philip Martin <philip.martin_at_wandisco.com>
Date: Thu, 13 Aug 2015 11:17:40 +0100

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.

-- 
Philip Martin
WANdisco
Received on 2015-08-13 12:18:13 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.