Skip to content

Constants Section use of const #1

@mattmassicotte

Description

@mattmassicotte

I think there's an error in the Constants section. You've indicated that its preferable to define a "pointer to a const NSString". I believe you actually want "a const pointer to an NSString".

NSString * const MyValue = @"blah";

This prevents you from accidentally assigning to the pointer. It also prevents all of the annoying warnings you'll get when calling methods that expect an NSString. Plus, NSString is immutable, so that outer const is just preventing the underlying struct from being modified, which is a very unusual thing to do.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions