Other Linker Flag all_load removes symbols in Instruments?

2009-10-30 Thread Eric Hermanson
Hello, I have been using Instruments successfully thus far, but I believe a recent change I made to Other Link Flags is causing the symbol information to disappear when running Leaks and CPU Sampler. I am using a 3rd party library on the iPhone that requires the -all_load flag to be turn

Is a serial NSOperationQueue FIFO?

2009-09-06 Thread Eric Hermanson
When working with a serial NSOperationQueue (i.e. setMaxConcurrentOperationCount==1), are the operations added to the queue guaranteed to run in FIFO order if all operations have the same priority and no operation dependencies are involved? My guess is that the NSOperationQueue will run th

Re: EXC_BAD_ACCESS in a Core Data application

2009-09-04 Thread Eric Hermanson
In my experience this can happen for at least 3 reasons. 1. Over-releasing an object, as you state. 2. Sending a message to an object that has already been released (i.e. deallocated). 3. Attempting to access or return a local variable that has not been initialized (although you may get a

NSData Questions

2009-08-08 Thread Eric Hermanson
1. Is it more efficient to malloc a uint8_t array and call NSData 'init no copy', rather than pass in an array allocated with a fixed length on the stack to the init method that makes a copy of the bytes? 2. Does NSMutableData's implementation simply just cast it's internal bytes to const

Re: Problem with NSDecimalNumber truncating zeros

2009-07-06 Thread Eric Hermanson
Suska wrote: On Jul 6, 2009, at 2:35 PM, Eric Hermanson wrote: NSDecimalNumber *number = [NSDecimalNumber decimalNumberWithMantissa:2200LL exponent:-2 isNegative:NO]; This results in a decimal number that is represented both internally, and as a string, as 22 instead of the

Problem with NSDecimalNumber truncating zeros

2009-07-06 Thread Eric Hermanson
Example: NSDecimalNumber *number = [NSDecimalNumber decimalNumberWithMantissa: 2200LL exponent:-2 isNegative:NO]; This results in a decimal number that is represented both internally, and as a string, as 22 instead of the desired 22.00 Because of the functionali

Re: GC pros and cons

2009-06-26 Thread Eric Hermanson
Everyone knows there's no garbage collection on the iPhone because the Waste Management Union #601 local convinced the nationwide union to protest their low wages by striking. They apparently didn't want to add one more garbage route to their workload with no increase in pay. I doubt we'l

Request assistance with GCC Warnings

2009-06-25 Thread Eric Hermanson
Hello, I realize this is really a GCC question, and not a Cocoa question, but I can't seem to find an adequate answer on the web. Considering I'm from a strictly Java background, I was hoping someone could clue me in to what the following two GCC warnings mean, if I should worry about th

Re: Beginner Question Re: Memory Management

2009-06-22 Thread Eric Hermanson
Objective-C 2.0 supports not only property getter/setter synthesis, but instance variable synthesis. This means that you do not even have to declare the instance variable. As long as the property is defined correctly, the instance variable (and the getter/setter) will be created for you

Re: Showing more warnings possible in Xcode?

2009-05-30 Thread Eric Hermanson
years, see: http://www.jetbrains.com/idea/documentation/inspections.jsp (very much worth the read, and maybe even try the app itself) - Eric On May 30, 2009, at 10:51 PM, Michael Ash wrote: On Sat, May 30, 2009 at 9:54 PM, Eric Hermanson wrote: Thanks for all the input. It would be nice if

Re: Showing more warnings possible in Xcode?

2009-05-30 Thread Eric Hermanson
The problem I have with this GCC __attribute__(unused) thing is that it does not result in an error if you actually end up using the attribute (as I would expect it should). If it went that extra step I would find it more useful than doing just (void)param..., but since it doesn't, I guess

Re: Showing more warnings possible in Xcode?

2009-05-30 Thread Eric Hermanson
Thanks for that list. Regarding your choice of GCC_WARN_UNUSED_PARAMETER = YES How do you get around the fact that you often get warnings for delegate methods you are forced to implement where you don't ever use given parameter(s)? Do you use a "#pragma GCC diagnostic ignored ..."

Re: Showing more warnings possible in Xcode?

2009-05-29 Thread Eric Hermanson
Thank You. I also just found this useful web page based on your feedback: http://developer.apple.com/TOOLS/xcode/staticanalysis.html On May 29, 2009, at 11:22 PM, Graham Cox wrote: On 30/05/2009, at 1:13 PM, Eric Hermanson wrote: Is there a way to tune xCode so that it warns you of

Showing more warnings possible in Xcode?

2009-05-29 Thread Eric Hermanson
I am periodically bitten by EXC_BAD_ACCESS memory problems that are sometimes hard to find. One that just occurred was that I was mistakenly returning an un-initialized local variable from a method (i.e. NSObject myObject; ... ... some if-statements ... return myObject; // I should hav

Re: Network Reachability APIs

2009-05-20 Thread Eric Hermanson
t its connection for some reason. - Eric On May 20, 2009, at 5:12 PM, Kyle Sluder wrote: On Wed, May 20, 2009 at 4:56 PM, Eric Hermanson wrote: I'm not so sure it's poppycock. The asynchronous IO APIs all do the work in a background thread (or a 'simulated' background v

Re: Network Reachability APIs

2009-05-20 Thread Eric Hermanson
u - what would you like the reachability API to do? Luke On May 20, 2009, at 1:54 PM, Eric Hermanson wrote: The Reachability only tells you if a network MIGHT be available. You still have to write code to do the data transfer. What if Reachability tells you the network is available, bu

Re: Network Reachability APIs

2009-05-20 Thread Eric Hermanson
t IO is IO that is done in the background is at all 'poppycock'. - Eric On May 20, 2009, at 4:27 PM, Kyle Sluder wrote: On Wed, May 20, 2009 at 4:21 PM, Eric Hermanson wrote: I understand what you are saying, but if you do IO correctly you'll do it in a background threa

Re: Network Reachability APIs

2009-05-20 Thread Eric Hermanson
n. If you're happy with your implementation, though, then you might not need it. Luke On May 20, 2009, at 1:21 PM, Eric Hermanson wrote: I understand what you are saying, but if you do IO correctly you'll do it in a background thread anyway. So waiting on a blocking socket unt

Re: Network Reachability APIs

2009-05-20 Thread Eric Hermanson
n spin lock. Luke On May 20, 2009, at 1:10 PM, Eric Hermanson wrote: Yes, but even if Reachability says a given host or route is available, that does not mean it will be available one second later, for example. You still have to try connecting to the host and transferring data, and you

Re: Network Reachability APIs

2009-05-20 Thread Eric Hermanson
On May 20, 2009, at 12:55 PM, Eric Hermanson wrote: On the iPhone, what's the point of the network Reachability APIs, when one can simply open a network socket (or input/output stream) and observe the EOF notices from the socket to determine network availability & reachabil

Network Reachability APIs

2009-05-20 Thread Eric Hermanson
On the iPhone, what's the point of the network Reachability APIs, when one can simply open a network socket (or input/output stream) and observe the EOF notices from the socket to determine network availability & reachability? In other words, if a network connection has to be made in the f

Re: Class Singleton Instantiation

2009-05-14 Thread Eric Hermanson
Thank You. Good explanation. The example/doc makes sense and seems to be the safest route, although possibly overkill for private code that is not going to be distributed to other developers. - Eric On May 14, 2009, at 9:46 PM, Kiel Gillard wrote: On 15/05/2009, at 11:32 AM, Eric

Class Singleton Instantiation

2009-05-14 Thread Eric Hermanson
In the CryptoExercise iPhone example, they allocate a shared instance like this: = static SecKeyWrapper * __sharedKeyWrapper = nil; + (SecKeyWrapper *)sharedWrapper { @synchronized(self) { if (__sharedKeyWrapper == nil) { [[self alloc] init];

Re: [iPhone] Caching images fetched from a URL?

2009-05-12 Thread Eric Hermanson
Obviously, if you want to cache the images between runs of the application, you need to cache them as binary onto the disk. If you are OK with the images being loaded after every launch of the application, you can cache them into an NSMutableDictionary with the URL as the key, and the imag

Re: NSNotificationQueue & NSOperationQueue thread death

2009-05-06 Thread Eric Hermanson
On May 6, 2009, at 12:24 AM, Michael Ash wrote: Background threads, whether directly managed by you or indirectly created by NSOperationQueue, do not use a runloop by default. I did not realize that. I knew threads created by the user did not use NSRunLoop, but I assumed threads created by

Re: NSNotificationQueue & NSOperationQueue thread death

2009-05-05 Thread Eric Hermanson
tically by performSelectorInBackground would have exited before that thread's NSNotificationQueue got a chance to deliver its notifications? - Eric On May 5, 2009, at 11:40 PM, Eric Hermanson wrote: The doc for NSNotificationQueue says: "When the thread where a notification is

NSNotificationQueue & NSOperationQueue thread death

2009-05-05 Thread Eric Hermanson
The doc for NSNotificationQueue says: "When the thread where a notification is enqueued terminates before the notification queue posts the notification to its notification center, the notification goes unposted." My question is, do the NSOperationQueue thread(s) stay around long enough so

NSRunLoop vs. NSThread sleep

2009-04-28 Thread Eric Hermanson
Hello, When implementing the while-loop in the main function of an NSThread, is it correct to assume it is more efficient on the operating system to run the current run-loop until a specified date rather than just use NSThread sleepUntilDate to obtain the delay? I ask because I don't rea

Re: passing complex objects between threads

2009-04-24 Thread Eric Hermanson
onLock lock]; if([_array count] < _capacity) { [_array addObject:object]; done = YES; } [self performUnlock]; } } On Apr 24, 2009, at 9:33 PM, Eric Hermanson wrote: I believe you should use a producer-consumer pattern

Re: passing complex objects between threads

2009-04-24 Thread Eric Hermanson
I believe you should use a producer-consumer pattern where the consumer thread waits on a blocking queue for the incoming object, and the producer thread passes the fetched object to the blocking queue after its fetched. There are many examples of producer/consumer on the web... - Eric

XCode Debugger Summary Format

2009-04-23 Thread Eric Hermanson
In using xCode 3.1.2 to debug an iPhone app in the Simulator, the debugger 'Summary' column shows the debugger format string instead of the formatted value. e.g. for NSArray it shows {(int)[$VAR count]} objects instead of the actual count of the array. Does anyone know why the su

Re: Accessing internal lock for atomic properties

2009-04-05 Thread Eric Hermanson
, at 11:53 PM, Bill Bumgarner wrote: On Apr 5, 2009, at 8:50 PM, Eric Hermanson wrote: I want to acquire the lock so that I can run some logic that requires changing a set of variables atomically. I suppose I'm going to have to create a new lock for this. Yes -- the synthesized locks are

Re: Accessing internal lock for atomic properties

2009-04-05 Thread Eric Hermanson
I want to acquire the lock so that I can run some logic that requires changing a set of variables atomically. I suppose I'm going to have to create a new lock for this. - Eric On Apr 5, 2009, at 11:48 PM, Bill Bumgarner wrote: On Apr 5, 2009, at 8:43 PM, Eric Hermanson wrote: Is

Accessing internal lock for atomic properties

2009-04-05 Thread Eric Hermanson
Hello, Is there any way to access the internal lock used when atomic properties are synthesized (assuming a simple @synchronized(self) is not used in this case)? - Eric ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post a

Re: Very interesting ordering caveat with NSArray arrayWithObjects:

2009-04-04 Thread Eric Hermanson
A comma is a sequence yet the order in arrayWithObjects is indeterminate. It must be the var arg causing the ordering mix. Sent from my iPhone On Apr 4, 2009, at 12:29 AM, Michael Ash wrote: On Fri, Apr 3, 2009 at 8:30 PM, Eric Hermanson wrote: Some (or most) people might be aware of

Very interesting ordering caveat with NSArray arrayWithObjects:

2009-04-03 Thread Eric Hermanson
Some (or most) people might be aware of this caveat, but I was not, so I'll share it. Consider this code: NSArray *array = [NSArray arrayWithObjects:[MyCounterClass newObject], [MyCounterClass newObject], nil]; where [MyCounterClass newObject] is a static method that returns a new au

Do synthesized instance variables work in iPhone SDK?

2009-03-24 Thread Eric Hermanson
I tried using Obj-C properties to synthesize not only the accessor methods, but also the instance variable. I ended up with an error saying something like "...must explicitly name an ivar...". I was under the impression the iPhone ran the modern (64-bit) Objective-C runtime. I'm using xCod