Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Constants #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Jan 16, 2016

  1. Constants declared as difines can be used in compile-time string co…

    …ncatenation. Example:
    
    ```objc
    \#define BaseCompanyName @"Netcosports"
    \#define EuropeCompanyName BaseCompanyName @" Europe"
    ```
    
    You can olso write:
    
    ```objc
    NSLog(@"Company name is " BaseCompanyName);
    ```
    
    For number constanst `define` form is also convinient, because they also can be appended to string and can be converted to `NSNumber` in compile time. Example:
    
    ```objc
    \#define thumbnailHaight 44
    NSArray* array = @[@thumbnailHeight];
    ```
    
    Form of `static` constanst doesn't have any conviniences and have one great defect:
    Every object file, that imports header with such constant, will have own local copy of it. It will be great memory hit, if such constant will be imported in .pch file.
    netcosportsanatoly committed Jan 16, 2016
    Configuration menu
    Copy the full SHA
    f6566e6 View commit details
    Browse the repository at this point in the history