Re: Code Guidelines
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.