• 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: Code Guidelines
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Code Guidelines


  • Subject: Re: Code Guidelines
  • From: Ondra Cada <email@hidden>
  • Date: Mon, 31 May 2004 18:54:27 +0200

Uli,

On 31.5.2004, at 17:08, M. Uli Kusterer wrote:

>> Since for globals, there already *is* a standard, which says "name
>> them
>> capitalized with a prefix", whilst locals should begin by a lowercase
>> ;)
>
> Haven't seen that used anywhere yet. Can you provide an example?

Sure. NSWindowWillCloseNotification -- a global const variable, NSMidX
-- a global gunction, NSString -- a global class name,
NSUnderlineByWordMask -- a global enumeration variable, NSCopying -- a
global protocol name.

You know, globals means global names, and there's a number of different
global names.

> The only one I can think of offhand is NSApp.

As for global variables, you simply should not use them: with ObjC and
its excellent support for singleton classes, there's absolutely no
reason to (not even efficiency, for even if the access time is
paramount, something like a pointer returned by a singleton would still
be a cleaner solution--or, if even that does not suffice, you should go
plain C or even assembly). If you do anyway, keep the rule mentioned
above. Just as Apple does -- with the NSApp which is a remnant of much
older age; in any newer code you should use [NSApplication
sharedApplication] instead.
---
Ondra Hada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc

[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
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.


References: 
 >Code Guidelines (From: Christoffer Lerno <email@hidden>)
 >Re: Code Guidelines (From: "M. Uli Kusterer" <email@hidden>)
 >Re: Code Guidelines (From: Georg Tuparev <email@hidden>)
 >Re: Code Guidelines (From: "M. Uli Kusterer" <email@hidden>)
 >Re: Code Guidelines (From: Ondra Cada <email@hidden>)
 >Re: Code Guidelines (From: "M. Uli Kusterer" <email@hidden>)

  • Prev by Date: Re: IBOutlet appears as type NSObject?
  • Next by Date: Re: Code Guidelines
  • Previous by thread: Re: Code Guidelines
  • Next by thread: Re: Code Guidelines
  • Index(es):
    • Date
    • Thread