• 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: retain variables between classes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: retain variables between classes


  • Subject: Re: retain variables between classes
  • From: Lawrence Meeran <email@hidden>
  • Date: Wed, 17 Dec 2003 00:03:59 +0000

hi

it's ok i just figured this one out:

i'm less clear about the issue with the mutability of the array; in this particular case (just setting an instance var) would it not make sense to declare the argument as NSArray rather than NSMutableArray?


... obviously not if you needed the argument to be mutable because the instance variable is mutable. (maybe other reasons too??)

but i've thought of another question relating to const declarations. In Stroustrup's "The C++ programming language" he makes a bit of a fuss about the importance of declaring arguments const if they are not modified. This came up on the list briefly a few days ago and i got the impression it was considered important in Obj-C also, by at least one list member, but I haven't seen much general discussion of it, which seems strange since many people here seem to be sticklers for careful design of classes -- something i would like one day to also be a stickler for.

i have plenty of methods that do not modify some/any of their arguments - i am considering going in and changing all their declarations to const before i go any further. I feel it may help the compiler to help me not to screw things up. Am i right? Is there any disadvantage to doing this?


L
_______________________________________________
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: declaring variables to be const (was retain variables between classes)
      • From: "Louis C. Sacha" <email@hidden>
References: 
 >Re: retain variables between classes (From: Lawrence Meeran <email@hidden>)

  • Prev by Date: Re: selected table row color ala itunes ?
  • Next by Date: NSSegmentedControl not giving small and mini variants?
  • Previous by thread: Re: retain variables between classes
  • Next by thread: Re: declaring variables to be const (was retain variables between classes)
  • Index(es):
    • Date
    • Thread