Re: My try/catch block isn't catching exceptions on 10.6

2009-11-30 Thread Kai Brüning
do stuff >> } @catch (NSException *e) { >> // NSException >> } @catch (id e) { >> // Other Objective-C exception >> } @catch (...) { >> // Non-ObjC exception >> // Decode it by rethrowing it inside a C++ try/catch. >> try {

Re: My try/catch block isn't catching exceptions on 10.6

2009-11-28 Thread Michael Ash
On Fri, Nov 27, 2009 at 2:40 PM, Mark Allan wrote: > > On 27 Nov 2009, at 1:10 am, Dave Keck wrote: >>> >>> Exception Type:  EXC_BAD_ACCESS (SIGBUS) >> >> After a cursory reading of your code it looks like you're dealing with >> a threading issue involving myItemList or imminentList. Your comment

Re: My try/catch block isn't catching exceptions on 10.6

2009-11-28 Thread Gwynne Raskind
eption >} @catch (id e) { >// Other Objective-C exception >} @catch (...) { >// Non-ObjC exception >// Decode it by rethrowing it inside a C++ try/catch. >try { >@throw; >} catch (std::bad_cast& e) { >// C

Re: My try/catch block isn't catching exceptions on 10.6

2009-11-28 Thread Greg Parker
On Nov 27, 2009, at 1:14 AM, Matt Gough wrote: The equivalent in Obj-c would be : @try { ... } @catch( NSException* e) { // deal with NSException } @catch(id ue) { // deal with any other sort of exception } There's also `...@catch (...)` in Objective-C. On iPhone and 64-bit Mac, `...@

Re: My try/catch block isn't catching exceptions on 10.6

2009-11-27 Thread Scott Ribe
If one thread reads imminentList while another is modifying it, you can crash. There are instants during the modification where it will be in an internally inconsistent state. -- Scott Ribe scott_r...@killerbytes.com http://www.killerbytes.com/ (303) 722-0567 voice _

Re: My try/catch block isn't catching exceptions on 10.6

2009-11-27 Thread Andrew Farmer
On 27 Nov 2009, at 11:40, Mark Allan wrote: > Isn't it the case that you only need locks around something if you plan that > it will be modified by more than one thread at a time, or if you write to it > in another thread and care that any read operation will be predictable? No, that is not the

Re: My try/catch block isn't catching exceptions on 10.6

2009-11-27 Thread Mark Allan
the message, but that's a programmer error... ... and shouldn't happen because no other thread has access to listToCopyFrom. Sending setObject:forKey: could throw an exception if the NSNumber is nil, but that would mean virtual memory exhaustion, what are you going to do if

Re: My try/catch block isn't catching exceptions on 10.6

2009-11-27 Thread Jeremy Pereira
throw an exception that you would want to handle. sending objectToKey: to listToCopyFrom could raise an exception if it has become shorter between the loop test and sending the message, but that's a programmer error. Sending setObject:forKey: could throw an exception if the NSNumber is ni

Re: My try/catch block isn't catching exceptions on 10.6

2009-11-27 Thread Matt Gough
On 27 Nov 2009, at 01:08:28, Graham Cox wrote: > Does Objective C support multiple catch blocks, like C++? In other words you > could do: > > @try > { > ... > } > @catch( NSException* e) > { > // deal with NSException > } > @catch(...) > { > // deal

Re: My try/catch block isn't catching exceptions on 10.6

2009-11-26 Thread Dave Keck
> PS. Yes, I know there are faster and more efficient ways to enumerate an > array, but the old-school 'for' loop approach still comes to mind first and > I still prefer it for small arrays. Overlooking the speed benefits, fast enumeration will also throw an exception if the array you're enumerati

Re: My try/catch block isn't catching exceptions on 10.6

2009-11-26 Thread Graham Cox
+? In other words you could do: @try { ... } @catch( NSException* e) { // deal with NSException } @catch(...) { // deal with any other sort of exception } If multiple catch blocks are not supported, you could just use the catch(...) variant though detecting what sort of exception it is

My try/catch block isn't catching exceptions on 10.6

2009-11-26 Thread Mark Allan
Hi folks, I've got a section of code which crashes intermittently under 10.6 but despite being enclosed in try/catch blocks, my app is still forced to terminate. For what it's worth, all of the crash reports are from 10.6.x. My app seems to be rock solid when run under 10.

Re: Implicit @try/@catch?

2009-11-11 Thread Shawn Erickson
On Tue, Nov 10, 2009 at 8:44 PM, Jim Kang wrote: > When I stepped through it, a sort of exception was thrown at the call to > methodSignatureForSelector (it didn't like that the selector had an argument > that was a raw pointer instead of an id or pointer to an Objective-C > object). A "sort of"

Re: Implicit @try/@catch?

2009-11-11 Thread Scott Ribe
Pardon, I misread. You said: > // THIS IS TO WHERE IT SKIPS. I thought that was: > // THIS IS WHAT IT SKIPS. -- Scott Ribe scott_r...@killerbytes.com http://www.killerbytes.com/ (303) 722-0567 voice ___ Cocoa-dev mailing list (Cocoa-dev@lists.appl

Re: Implicit @try/@catch?

2009-11-11 Thread Scott Ribe
> Any explanations for the jump? Well, *if* an exception was thrown, of course the rest of the method was skipped over. That's what happens when an exception is thrown, all code all the way up the stack is skipped until the next matching catch block. -- Scott Ribe scott_r...@killerbytes.com http

Re: Implicit @try/@catch?

2009-11-10 Thread Jens Alfke
On Nov 10, 2009, at 8:44 PM, Jim Kang wrote: > I ran some code that apparently threw an exception of sorts, but it was > "caught" without any code explicit @catch block. It was like this: Weird — I don't know of anything that would cause that. Is this a Release build? The code optimization/reor

Implicit @try/@catch?

2009-11-10 Thread Jim Kang
thrown at the call to methodSignatureForSelector (it didn't like that the selector had an argument that was a raw pointer instead of an id or pointer to an Objective-C object). Execution then jumped outside of the if block, skipping over the rest of the code in the if block. There's no

Re: @try @catch

2008-08-14 Thread Ken Ferry
On Thu, Aug 14, 2008 at 5:45 AM, Uli Kusterer <[EMAIL PROTECTED]> wrote: > On 14.08.2008, at 12:58, Georg Seifert wrote: >> >> is it recommended to use @try .. @catch blocks as flow control like it is >> used in Python. They say explicitly to use it rather than do a lot

Re: @try @catch

2008-08-14 Thread j o a r
On Aug 14, 2008, at 5:34 PM, Andrew Farmer wrote: Python has been optimized to handle exceptions quickly, so it's often faster to catch exceptions than to check for exceptional situations in Python code. Objective-C has not been similarly optimized*, so checking for errors before attemptin

Re: @try @catch

2008-08-14 Thread Andrew Farmer
On 14 Aug 08, at 03:58, Georg Seifert wrote: is it recommended to use @try .. @catch blocks as flow control like it is used in Python. They say explicitly to use it rather than do a lot of test before just try if it works to look after it only if it fails. Python has been optimized to

Re: @try @catch

2008-08-14 Thread Michael Watson
I was only looking at: Which fails to mention the note seen in NSFileManager.h. I'll file a docs bug. Thanks for the

Re: @try @catch

2008-08-14 Thread Uli Kusterer
On 14.08.2008, at 20:38, Michael Watson wrote: On 14 Aug, 2008, at 08:45, Uli Kusterer wrote: On 14.08.2008, at 12:58, Georg Seifert wrote: is it recommended to use @try .. @catch blocks as flow control like it is used in Python. They say explicitly to use it rather than do a lot of test

Re: @try @catch

2008-08-14 Thread Clark Cox
On Thu, Aug 14, 2008 at 11:38 AM, Michael Watson <[EMAIL PROTECTED]> wrote: > Don't forget that many of Apple's own methods return nil on failure and > don't implement an NSError reference mechanism. NSFileManager's > -contentsAtPath: method returns either an NSData object on success or nil on > fa

Re: @try @catch

2008-08-14 Thread Michael Watson
Kusterer wrote: On 14.08.2008, at 12:58, Georg Seifert wrote: is it recommended to use @try .. @catch blocks as flow control like it is used in Python. They say explicitly to use it rather than do a lot of test before just try if it works to look after it only if it fails. Apple's stance

Re: @try @catch

2008-08-14 Thread Michael Ash
On Thu, Aug 14, 2008 at 7:21 AM, Graham Cox <[EMAIL PROTECTED]> wrote: > > On 14 Aug 2008, at 8:58 pm, Georg Seifert wrote: > >> is it recommended to use @try .. @catch blocks as flow control like it is >> used in Python. They say explicitly to use it rather than do a

Re: @try @catch

2008-08-14 Thread Uli Kusterer
On 14.08.2008, at 12:58, Georg Seifert wrote: is it recommended to use @try .. @catch blocks as flow control like it is used in Python. They say explicitly to use it rather than do a lot of test before just try if it works to look after it only if it fails. Apple's stance on excep

Re: @try @catch

2008-08-14 Thread Jean-Daniel Dupas
Le 14 août 08 à 13:53, Devon Ferns a écrit : On 14-Aug-08, at 7:21 AM, Graham Cox wrote: On 14 Aug 2008, at 8:58 pm, Georg Seifert wrote: is it recommended to use @try .. @catch blocks as flow control like it is used in Python. They say explicitly to use it rather than do a lot of

Re: @try @catch

2008-08-14 Thread Devon Ferns
On 14-Aug-08, at 7:21 AM, Graham Cox wrote: On 14 Aug 2008, at 8:58 pm, Georg Seifert wrote: is it recommended to use @try .. @catch blocks as flow control like it is used in Python. They say explicitly to use it rather than do a lot of test before just try if it works to look after it

Re: @try @catch

2008-08-14 Thread Graham Cox
On 14 Aug 2008, at 8:58 pm, Georg Seifert wrote: is it recommended to use @try .. @catch blocks as flow control like it is used in Python. They say explicitly to use it rather than do a lot of test before just try if it works to look after it only if it fails. Hmmm, I'll be lo

@try @catch

2008-08-14 Thread Georg Seifert
hello, is it recommended to use @try .. @catch blocks as flow control like it is used in Python. They say explicitly to use it rather than do a lot of test before just try if it works to look after it only if it fails. I could imagine something: - (id) layerInstance { if