Re: Ternary Operator (was: [PATCH mdadm v2] super1: report truncated device)

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

 



On Thu, 21 Jul 2022 18:21:46 +0200
Paul Menzel <pmenzel@xxxxxxxxxxxxx> wrote:

> Dear Mariusz,
> 
> 
> Am 21.07.22 um 10:19 schrieb Mariusz Tkaczyk:
> 
> > On Wed, 13 Jul 2022 13:48:11 +1000 NeilBrown wrote:  
> 
> […]
> 
> >> +	}
> >> +	printf("          State : %s%s\n",
> >> +	       (__le64_to_cpu(sb->resync_offset)+1)? "active":"clean",
> >> +	       info.space_after > INT64_MAX ? " TRUNCATED DEVICE" : "");  
> > 
> > Could you use standard if instruction to make the code more readable? We are
> > avoiding ternary operators if possible now.  
> 
> That’s news to me. Where is that documented? If find the operator quite 
> useful in situations like this.
> 
> 
Hi Paul,
It was Jes's preference, however I don't remember exactly when and where he
pointed that (and I cannot find it now).

To clarify - I meant inline\ternary if only.

Jes, could you look?

As you said, in this case ternary is useful, so I give it to Neil to decide
if it can be easily replaced. If not- I'm fine with current approach.

Thanks,
Mariusz




[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux