Y
Hacker News
new
|
ask
|
show
|
jobs
by
jemeshsu
5228 days ago
Nice. I wish for ability for function to return multiple values. Is it possible at all?
2 comments
0x0
5228 days ago
Probably not, but with the new dictionary literal syntax, returning a dictionary with a set of keys-values should be a breeze :)
link
pornel
5228 days ago
You can use C99 struct literals:
return (struct x){a,b};
Small structs may be passed in registers.
http://stackoverflow.com/a/3355560/27009
link
drpancake
5228 days ago
IIRC passing Obj-C object pointers in C structs is disallowed or discouraged by ARC.
link
DrJokepu
5228 days ago
You have to explicitly bridge them in or out of ARC and indicate the ownership rules. Sometimes, for example when you're interfacing straight C code, you have no other option.
link