qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC][PATCH v2 15/17] guest agent: qemu-ga daemon


From: Jes Sorensen
Subject: Re: [Qemu-devel] [RFC][PATCH v2 15/17] guest agent: qemu-ga daemon
Date: Tue, 26 Apr 2011 15:39:15 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Thunderbird/3.1.9

On 04/25/11 14:27, Ian Molton wrote:
> On Fri, 2011-04-22 at 13:51 +0200, Jes Sorensen wrote:
>> Hiding things you miss when reading the code, it's a classic for 
>> people to do if(foo) bleh(); on the same line, and whoever reads
>> the code will expect the action on the next line, especially if foo
>> is a long complex statement.
>>
>> It's one of these 'just don't do it, it bites you in the end' things. 
> 
> Meh. I dont see it that way...
> 
> Sure, if it was one line out of 20 written that way, it would be weird,
> but as is, its just part of a block of identical lines.

It is a matter of consistency, we allow it in one place, we suddenly
have it all over. The moment someone wants to add a slightly more
complex case to such a switch statement it is all down the drain. It is
way better to stay consistent across the board.

> I dont really see a parallel with the if() statement either since the
> condition in the switch() case isnt on the same line as such. I must
> admit that I only write one-liner if statements if the condition is
> short though.

Writing one-liner if() statements is inherently broken, or you could
call it the Perl syndrome. Write-once, read-never.....

Jes



reply via email to

[Prev in Thread] Current Thread [Next in Thread]