• 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: Scope variable pattern
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scope variable pattern


  • Subject: Re: Scope variable pattern
  • From: Erik Buck <email@hidden>
  • Date: Fri, 11 May 2007 08:54:36 -0700 (PDT)

I am a very accomplished C++ programmer with more than a decade of experience writing and maintaining C++ code.  I have to ask, why do you want to replace two lines of code that are explicit and intention revealing with the trick of relying on a side effect of constructor/destructor semantics that conceals the intent of the code ?

  struct ScopedDoing {
   ScopedDoing () { /* doing.. */ }
   ~ScopedDoing () { /* clean up.. */ }
};
..
<some function body>
{    ScopedDoing aScopedDoing; ...
}
..
  The poor slob who has to figure out what your code does now absolutely must go look up the implementation of the ScopedDoing class in order to understand what <some function body> does.

  In all seriousness, have you ever heard of the "obfuscated C contest" ? http://en.wikipedia.org/wiki/International_Obfuscated_C_Code_Contest

  There is no reason to hold an obfuscated C++ contest.  Have you ever seen the logic of a program implemented in a constructor so that the main function for the program looks like this:

  int main(int argc, const char *argv[])
  {
     SomeClass       anInstance;
     return 0;
  }

  How is what you want different except in degree of obfuscation ?

  I am not trying to start a language war.  I use C++ daily, and I have seen lots of fast elegant easily maintained C++ code.  I am just struck by the absurdity of this particular request.  However, I fully agree that my perception of absurdity may be different that other people's.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: Scope variable pattern
      • From: Roy Lovejoy <email@hidden>
    • Re: Scope variable pattern
      • From: Paul Thomas <email@hidden>
    • Re: Scope variable pattern
      • From: Roy Lovejoy <email@hidden>
    • Re: Scope variable pattern
      • From: Yakov Zaytsev <email@hidden>
  • Prev by Date: Re: changing the default color for text drawing
  • Next by Date: Re: Scope variable pattern
  • Previous by thread: Re: Scope variable pattern
  • Next by thread: Re: Scope variable pattern
  • Index(es):
    • Date
    • Thread