[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: Julian Foad <julianfoad_at_btopenworld.com>
Date: Thu, 13 Aug 2015 16:44:24 +0100

FWIW, I too have come to prefer the variable-based form, for
readability reasons. One reason is that it is easier to quickly
recognize and verify the idiom when the redundancy is in the form of
two identical names close together:

svn_my_type_t *my_var;
foo(my_var, sizeof(*my_var)); <== 'my_var' twice

than when the nearby pairing uses two different names and the
repetition of the type name is widely separated:

svn_my_type_t *my_var;
foo(my_var, sizeof(svn_my_type_t));

especially when the declaration was separate from the statement that uses it.

Another reason is that the variable name is usually shorter, the
entire statement often fitting on one line, whereas the type name is
usually a public, user-defined type (or pointer to such) with a longer

- Julian
Received on 2015-08-13 20:20:29 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.