V
V
vfvnvsyevsky2015-01-03 22:36:04
Objective-C
vfvnvsyevsky, 2015-01-03 22:36:04

What is the difference between void and Id in objective-c?

As I understand it, they are both used when an undefined type is needed, so what's the difference?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
An, 2015-01-03
@vfvnvsyevsky

Did you mean void* ?
The difference is that id is a pointer to objective - c objects, while void* is a pointer to an undefined type, or just a memory area (which can store anything).
stackoverflow.com/questions/1304176/objective-c-di...

M
ManWithBear, 2015-01-03
@ManWithBear

id is an objective-c object
void is void/nothing in C
void* is a pointer to a variable of unknown type in C
To be more precise, id is a pointer to the object structure in objective-c.
If you are very interested, you can see more details in usr/include/objc/objc.h

/// Represents an instance of a class.
struct objc_object {
    Class isa  OBJC_ISA_AVAILABILITY;
};

/// A pointer to an instance of a class.
typedef struct objc_object *id;

K
Konstantin Tsvetkov, 2017-06-04
@Amigo83

There was a need to purchase a new UPS.
Maybe replacing the batteries will help (much cheaper)?
It remains to decide on the company
Powercom VANGUARD RM VRT-2000XL
I used to like APC, but after buying them from the French, I switched to PCM.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question