qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] CODING_STYLE and if blocks


From: Natalia Portillo
Subject: Re: [Qemu-devel] CODING_STYLE and if blocks
Date: Fri, 23 Oct 2009 00:10:00 +0100

  if (a == 5)
  {
      printf("a was 5.\n");
  }
  else if (a == 6)
  {
      printf("a was 6.\n");
  }
  else
  {
      printf("a was something else entirely.\n");
  }

Is in my opinion LOT CLEANER to debug.


This is my personal preference (comments included):
  if (a == 5) // Check if it is 5
  {
      printf("a was 5.\n");
  }
  else // It was not 5
  {
      if (a == 6)
      {
           printf("a was 6.\n");
      }
      else // Neither was 6
      {
           printf("a was something else entirely.\n");
      }
  }

El 22/10/2009, a las 23:01, Aurelien Jarno escribió:

Hi all,

I am currently reviewing the S390 patches which extensively use of
code like:

  if (a == 5) printf("a was 5.\n");
  else if (a == 6) printf("a was 6.\n");
  else printf("a was something else entirely.\n");

It is something currently allowed by the CODING_STYLE document (there is
no "indented statement"), but I am not fully comfortable with it. Should
we accept such code? Should we fix CODING_STYLE?

Cheers,
Aurelien

-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
address@hidden                 http://www.aurel32.net



reply via email to

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