[libvirt] [PATCH v3 1/4] iptablesFormatNetwork(): constify target of "netaddr" parameter

Laine Stump laine at laine.org
Wed Sep 25 08:27:33 UTC 2013


On 09/24/2013 09:03 AM, Laszlo Ersek wrote:
> On 09/24/13 10:46, Laine Stump wrote:
>> On 09/23/2013 08:03 PM, Laszlo Ersek wrote:
>>> ... and adapt functions that would cast away the new const qualifier.
>>>
>>> Given
>>>
>>>   typedef virSocketAddr *virSocketAddrPtr;
>>>
>>> Compare the parse trees of the following two declarations:
>>>
>>>   (a) const virSocketAddrPtr  addr;
>>>   (b) const virSocketAddr    *addr;
>> Umm.. Eric? A little help? :-)
> The grammar rules that I used for the AST derivation can be looked up
> eg. in the final C11 draft,
>
>   http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf
>
> Section 6.7 "Declarations".
>
>
> But, the short version is really just that type qualifiers (like const &
> volatile) don't enter the typedef name; they qualify the variable being
> declared.

I like your explanation better :-)

> In general I disapprove of typedefs: they seem to be friendly by saving
> you the repeated typing of "struct" and "*". Until they trick you :)

I like typedefs for eliminating repetitive typing of "struct", but not
for removing "*" - that seems pointless to me (pun not intended), since
you're not saving any characters, and losing track of the nice "*" that
everyone is used to seeing.




More information about the libvir-list mailing list