• 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: Refactoring tools was: Declarations near usage
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Refactoring tools was: Declarations near usage


  • Subject: Re: Refactoring tools was: Declarations near usage
  • From: tibbetts <email@hidden>
  • Date: Wed, 16 Oct 2002 22:26:26 -0400 (EDT)

Quoting Keith Ray <email@hidden>:

> On Wednesday, October 16, 2002, at 12:37 PM, Scott Anguish wrote:
>
> > On Wednesday, October 16, 2002, at 02:48 PM, James Hober wrote:
> >
> >> One thing I don't like about Objective C is that you have to declare
>
> >> variables at the top of a block. I think code that declares
> >> variables near their first use is much more readable. This is the
> >> norm in C++.
> >
> > This is also the norm in Objective-C with the latest compiler
> > (included with 10.2)
> >
>
> Two reasons to put declarations at the same place as first usage
> (initialization)
> 1. if you make a habit of it, it guarantees that variables are always
> initialized - bugs from uninitialized variables are nasty.

If this is your main concern, passing "-Wunused-variable" (or many other "-Wx"
options; see
http://gcc.gnu.org/onlinedocs/gcc-3.2/gcc/Warning-Options.html#Warning Options)
to gcc (2.x and 3.x, and probably more) will alert you to this.

For those who don't know how to do this, you can do this for each open project
in Project Builder by selecting the Project->Edit Active Target... menu,
selecting the "Build Settings" tab, and entering the compiler flags in the
"Other Compiler Flags" field under "Compiler Settings".


jason r tibbetts
www.toad.net/~tibbetts/jason

:wq


_________________________________________________________________________
This mail sent via toadmail.com, web e-mail @ ToadNet - want to go fast?
http://www.toadmail.com
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Refactoring tools was: Declarations near usage
      • From: Keith Ray <email@hidden>
References: 
 >Refactoring tools was: Declarations near usage (From: Keith Ray <email@hidden>)

  • Prev by Date: Selecting Root of sub menu (NSMenu)
  • Next by Date: Re: Declarations near usage
  • Previous by thread: Refactoring tools was: Declarations near usage
  • Next by thread: Re: Refactoring tools was: Declarations near usage
  • Index(es):
    • Date
    • Thread