On 27/05/2011, at 11:23 AM, Quincey Morris wrote:

> On May 26, 2011, at 18:00, Graham Cox wrote:
> 
>>      unsigned seed = (unsigned)([NSDate timeIntervalSinceReferenceDate] * 
>> 10000.0);
>>      
>>      NSLog(@"launched, seed = %ld", seed );
> 
> Also, be careful here, because %ld is the wrong format specifier for type 
> 'unsigned'. Whether it logs the right value is going to be architecture 
> dependent.

Ok, then that raises the question what should I use? I'm confused about how to 
correctly write format specifiers for both 32 and 64-bit runtimes. The 64-bit 
porting guide doesn't spell it out (yet you end up with code peppered with 
warnings that you should examine the use of the format specifier without docs 
properly explaining their correct use). It's also not clear to me whether just 
'unsigned' is a fixed-size quantity or not, depending on architecture.

Someone mentioned that random() has been superseded. Again??! It seems to me 
that random number generators get superseded every other week. How is anyone 
supposed to know what is considered current best practice? Especially as for 
such functions there doesn't seem to be a simple way to see in man pages or 
other documentation what's deprecated.

--Graham_______________________________________________

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