On 9/18/12, Eric Botcazou <[email protected]> wrote:
>> When, the property test is embedded within a larger condition, a little
>> restructuring is required to pull out the secondary conditions. For
>> example,
>>
>> if (symtab_variable_p (node)
>> && varpool (node)->finalized)
>> varpool_analyze_node (varpool (node));
>>
>> becomes
>>
>> if (varpool_node *vnode = node->try_variable ())
>> if (vnode->finalized)
>> varpool_analyze_node (vnode);
>
> Please avoid cascading if's like this, use the existing && idiom instead.
The language syntax would bind the conditional into the intializer, as in
if (varpool_node *vnode = (node->try_variable ()
&& vnode->finalized))
varpool_analyze_node (vnode);
which does not type-match.
So, if you want the type saftey and performance, the cascade is really
unavoidable.
--
Lawrence Crowl