Afficher un message
Vieux 15/10/2007, 22h08   #3
Juha Nieminen
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: comparison logic!!

Puppet_Sock wrote:
> On Oct 15, 1:01 pm, Juha Nieminen <nos...@thanks.invalid> wrote:
> [snip]
>> If you want to do your homework in a bit more obfuscated way, you can
>> do that with a one-liner:
>>
>> max = A > B ? A > C ? A : C : B > C ? B : C;

>
> I compiled this, with appropriate int main etc.
> added to make a complete program. It printed out
> the words to Aida.


Are you trying to imply that the standard doesn't define precedence
rules for nested ?: operators?

I suppose you could make it more unambiguous by using clarifying
parentheses, like:

max = A > B ? (A > C ? A : C) : (B > C ? B : C);

However, are they really necessary (except for the human reader)?
  Réponse avec citation
 
Page generated in 0,05537 seconds with 9 queries