• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Style Question (Robert Claeson)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Style Question (Robert Claeson)


  • Subject: Re: Style Question (Robert Claeson)
  • From: Andreas Mayer <email@hidden>
  • Date: Fri, 4 Jul 2008 22:56:22 +0200


Am 04.07.2008 um 18:16 Uhr schrieb Gary L. Wade:

For example, this kind of code just bugs me when I'm balancing braces back-and-forth:

Well, I find *this* one preferable:

#if WE_WANT_TO_ADD_THIS_FEATURE_IN_FINAL_BUILDS
   if (thisTestIsTrue && newFunctionalityIsAvailable) {
#else
   if (thisTestIsTrue) {
#endif
       ...
   }
   else
   {
       ...
   }

Removing the redundant comments helps readability a lot more, than shifting a brace, IMHO. :)

Actually, in my code it'd probably look like this:


#if WE_WANT_TO_ADD_THIS_FEATURE_IN_FINAL_BUILDS

   if (thisTestIsTrue && newFunctionalityIsAvailable) {

#else

   if (thisTestIsTrue) {

#endif
       ...
   } else {
       ...
   }

Because I try to make stand out things that are *important*.

but when you're talking about thousands or millions of lines of code (as this guy unnecessarily touched) to go through, it's probably more trouble than it's worth,

Obviously.

and it's an easy way to anger people when something that had been working perfectly well is now broken.

Well, just reformatting really shouldn't be able break the build.

Since it's easier for me to read code that is formatted the way *I* like it, I would be happy if the editor was able to reformat everything on the fly. That would save me time not only because I didn't need to reformat by hand but also because it'd speed up my reading/understanding. Should be possible, no?


Andreas _______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Style Question (Robert Claeson)
      • From: Scott Ribe <email@hidden>
References: 
 >Re: Style Question (Robert Claeson) (From: Scott Ribe <email@hidden>)
 >Re: Style Question (Robert Claeson) (From: "Gary L. Wade" <email@hidden>)

  • Prev by Date: Re: c++ exceptions in objective c call stack
  • Next by Date: Re: garbage collection and NSConnection
  • Previous by thread: Re: Style Question (Robert Claeson)
  • Next by thread: Re: Style Question (Robert Claeson)
  • Index(es):
    • Date
    • Thread