I tried to use the async sockets for UDP sockets with ARC under iOS5 sdk, but ran into the problem that the arc branch does not contain the UDP class, and the master branch's AsyncUdpSocket and GCDAsyncUdpSocket do not compile with ARC and regular compiler settings. It's not just simple changes of pointer handling. The compiler also complains about some gotos, that jump over variable declarations and thus break the ref counting.
I'm currently a beginner with iOS programming and busy with getting used to it, so I'm not yet really familiar with every detail of the former and the new memory management model. My assumption is that the main changes will be to replace methods like retain, release with simple pointer assignments, but replacing the gotos would require changes in the program's logic and flow.
Is anyone more experienced with iOS and the asyncsocket library planning to make a ARC version of the UDP socket?
On Wed, 4 Jan 2012 00:34:10 +0100, Hadmut Danisch said:
>I tried to use the async sockets for UDP sockets with ARC under iOS5 >sdk, but ran into the problem that the arc branch does not contain the >UDP class, and the master branch's AsyncUdpSocket and GCDAsyncUdpSocket >do not compile with ARC and regular compiler settings. It's not just >simple changes of pointer handling. The compiler also complains about >some gotos, that jump over variable declarations and thus break the ref >counting.
I haven't tried the ARC branch, but CocoaAsyncSocket doesn't need to support ARC to work in an ARC application. ARC apps can use manual ref counted code, just add -fno-objc-arc to any files that aren't ARC.
-- ____________________________________________________________ Sean McBride, B. Eng s...@rogue-research.com Rogue Research www.rogue-research.com Mac Software Developer Montréal, Québec, Canada
> I haven't tried the ARC branch, but CocoaAsyncSocket doesn't need to support ARC to work in an ARC application. ARC apps can use manual ref counted code, just add -fno-objc-arc to any files that aren't ARC.
Yeah, I've seen that somewhere, but I'm not sure whether it is a good idea to mix code with and without that flag. I always prefer the clean version over the workaround. And for the TCP socket, there is for some reason a separate arc version. So maybe the UDP version is under construction as well...
> Am 04.01.2012 23:57, schrieb Sean McBride: >> I haven't tried the ARC branch, but CocoaAsyncSocket doesn't need to support ARC to work in an ARC application. ARC apps can use manual ref counted code, just add -fno-objc-arc to any files that aren't ARC.
> Yeah, I've seen that somewhere, but I'm not sure whether it is a good > idea to mix code with and without that flag. I always prefer the clean > version over the workaround. And for the TCP socket, there is for some > reason a separate arc version. So maybe the UDP version is under > construction as well...
> regards
> -- > You received this message because you are subscribed to the Google Groups "CocoaAsyncSocket" group. > To post to this group, send email to cocoaasyncsocket@googlegroups.com. > To unsubscribe from this group, send email to cocoaasyncsocket+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/cocoaasyncsocket?hl=en.
ARC works during compilation not during runtime so it is perfectly ok
to mix ARC and non ARC code. Basically, with ARC, the compiler will
itself insert retain/realease calls into your code before actually
compiling
cheers ;)
On Jan 5, 12:19 am, Hadmut Danisch <had...@danisch.de> wrote:
> > I haven't tried the ARC branch, but CocoaAsyncSocket doesn't need to support ARC to work in an ARC application. ARC apps can use manual ref counted code, just add -fno-objc-arc to any files that aren't ARC.
> Yeah, I've seen that somewhere, but I'm not sure whether it is a good
> idea to mix code with and without that flag. I always prefer the clean
> version over the workaround. And for the TCP socket, there is for some
> reason a separate arc version. So maybe the UDP version is under
> construction as well...