Re: NSData dataWithBytes problem on Intel
Re: NSData dataWithBytes problem on Intel
- Subject: Re: NSData dataWithBytes problem on Intel
- From: "Shawn Erickson" <email@hidden>
- Date: Wed, 21 Mar 2007 12:36:58 -0700
On 3/21/07, Sam Waters <email@hidden> wrote:
The solution:
Here's what I was doing:
NSData * dTempData = [NSData dataWithBytes:[self Function] length:iLen];
iLen is a class variable that got updated in Function. On the PPC iLen would be
updated in time, but on the Intel it wouldn't be. Oddly enough that same line
of code works fine on my Windows XP port. (in C++ syntax of course)
Humm... that seems like a possible compiler bug to me.
The compiler should see that a message is being sent ("[self
Function]") and require the reloading of any non-local non-const
variables used in the second message before attempting to send the
second message ([NSData dataWithBytes:...]).
As Andy notes maybe the Objective-C standard (maybe even C) doesn't
make a statement on any particular evaluation order of parameters like
it does for the evaluation of boolean logic statements (short-circuit
evaluation)... humm... IMHO I believe the compiler should ensure any
nested messages are sent before reading any non-local non-const
variables despite any definition (or lack thereof) about evaluation
order. It may just be one of those undefined things... aka like "i =
++i + 1;".
-Shawn
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden