Should we assume you have eliminated the obvious, that the arguments to NSLog 
don't have any method calls with side effects?

Or are there multiple threads whose timing could be changed by the logging?



________________________________
From: James Maxwell <jbmaxw...@rubato-music.com>
To: Cocoa Dev <cocoa-dev@lists.apple.com>
Sent: Thursday, 19 March, 2009 9:05:31 AM
Subject: NSLog fixes output, but why?

I've got a really frustrating, and really silly problem.

I have some fairly complex machine learning code I'm working on. I've noticed 
inconsistent output from a particular method. I'm doing some fairly nasty array 
and matrix stuff, which is all done in C, and I pass the arrays around wrapped 
in NSData objects. What's really strange is that, in this particular method, if 
I place an NSLog after calling and unwrapping a particular 2D matrix, then the 
output is as expected. If I remove the NSLog, the output is incorrect (or at 
least, unexpected). The system is pretty complex, and involves 4 different 
classes, so I won't post it here, and obviously I don't expect any magical 
help. But does anybody have any experience with something this flaky? Whereby 
literally adding a single NSLog (and thus obviously slowing things down a fair 
bit) makes the method run correctly?... It's just bizarre, to me.

Maybe somebody here has worked their way into a similar corner? Obviously I've 
done something stupid somewhere, but I don't really know how to go about 
finding it. It was weird enough to realize that the NSLog could make or break 
my output - tracking down the actual reason why is just baffling... Everything 
being done in these classes is basically procedural stuff, so it doesn't seem 
like timing should dramatically influence the output. But I am doing *lots* of 
iterations over this data. Does that suggest anything?

Any thoughts very much appreciated.

cheers,

J.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/idou747%40yahoo.com

This email sent to idou...@yahoo.com



      Stay connected to the people that matter most with a smarter inbox. Take 
a look http://au.docs.yahoo.com/mail/smarterinbox
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to