Tagged Questions
2
votes
1answer
1k views
ios public static const equiv
I'm trying to accomplish a C style version of public static const
What I tried doing already:
ClassA.h
extern const int FEATURES;
ClassA.m
#define THE_CONST 123
ClassB.b
#import ClassA.h
...
1
vote
3answers
684 views
Difference between external variable of some sort and static variable
What the difference between external variable of some sort and static variable?
//ClassA.m
NSString *var1;
static NSString *var2;
@implementation ClassA
...
7
votes
1answer
2k views
“extern const” vs “extern” only
I've seen 2 ways of creating global variables, what's the difference, and when do you use each?
//.h
extern NSString * const MyConstant;
//.m
NSString * const MyConstant = @"MyConstant";
and
//.h
...
2
votes
2answers
459 views
Linking External Constants — Objective C
In an earlier answer about external constants, the preferred answer says
"Constants.m should be added to your application/framework's target so
that it is linked in to the final product."
I am ...
11
votes
4answers
4k views
How to declare my very own CGRectZero like constant?
This is a newbie C/Objective-C question :-)
Let say I want a CGRectOne and a CGRectTwo constants.
How can I declare that?
Thanks,
Jérémy
1
vote
2answers
2k views
C++: Linking extern variables from within a namespace
I can't seem to reference an externally-defined variable from within a namespace using extern. It works from the global scope, but as soon as a namespace is thrown in there, it fails to link.
My ...
11
votes
3answers
3k views
How to name a constant in Objective-C?
What's the naming convention for constants in Objective-C (or most widely used way to name them)?
Is there a different criteria for extern constants?
Some styles I have seen:
NSString* const ...
8
votes
8answers
5k views
C++ best way to define cross-file constants
I am working on a game and have an interesting question. I have some game-wide constant values that I want to implement in one file. Right now I have something like this:
constants.cpp
extern const ...