I'm confused on whether or not the term "scalar" means the same thing as "primitive" for Objective-C. It sounds like they mean the same thing and can be used interchangeably.
I just view both as being basic C data types like BOOL
, int
, char
, float
, and double
.
In Apple's documentation, they seem to use the two terms interchangeably multiple times, but I want to be sure on this.
Even if there is a slight difference, I would like to know.
Objective-C is known for having weird/unique intricacies when compared to other languages; I'm not sure if there's a special use of these terms.
As far as I understand that linked documentation, scalars
is data that is one slot of memory large, where a slot may be 1, 2, 4,… bytes. The number of bytes is defined by the architecture of the processor, the compiler and variable type.
The term primitives seem to include also arrays of any of this types and pointers to scalars.
It is not clear if C structures are seen as primitives or not.
from a Objective-C programer's perspective you could define: If it is an pointer to an instance of a class, it is an object, else a C primitive (structs included). Further if I need to use a wrapper object of NSNumber, to store it in NSArray, it is a scalar.