Re: Can an NSArray ever have a count of -1?

2016-02-19 Thread Quincey Morris
On Feb 19, 2016, at 22:14 , Gerriet M. Denkmann wrote: > > Is there (yet) a Swift version of ‘[NSString stringWithFormat: “%08lx”, > (someCast) someValue]’ ? No, and yes, and no, and yes. There is currently AFAIK no such native formatting syntax in Swift print statements, so “no”. But you ca

Re: Can an NSArray ever have a count of -1?

2016-02-19 Thread Roland King
> On 20 Feb 2016, at 14:14, Gerriet M. Denkmann wrote: > > >> On 20 Feb 2016, at 13:02, Quincey Morris >> wrote: >> >> On Feb 19, 2016, at 21:30 , Gerriet M. Denkmann wrote: >> >> Now that I code almost exclusively in Swift, the problem has largely >> disappeared, because ‘“\(someValue)"'

Re: Can an NSArray ever have a count of -1?

2016-02-19 Thread Gerriet M. Denkmann
> On 20 Feb 2016, at 13:02, Quincey Morris > wrote: > > On Feb 19, 2016, at 21:30 , Gerriet M. Denkmann wrote: > > Now that I code almost exclusively in Swift, the problem has largely > disappeared, because ‘“\(someValue)"' is a lot easier*** than ‘[NSString > stringWithFormat: "%lu", (som

Re: Can an NSArray ever have a count of -1?

2016-02-19 Thread Quincey Morris
On Feb 19, 2016, at 21:30 , Gerriet M. Denkmann wrote: > > One can NOT force NSUInteger to be different sizes. It will always be 4 bytes > on 32 bit systems, and 8 bytes on 64 bit ones. > > 32 bit without DNS_BUILD_32_LIKE_64 > NSUInteger = int; > 32 bit with DNS_BUILD_32_LIKE_64 >

Re: Can an NSArray ever have a count of -1?

2016-02-19 Thread Gerriet M. Denkmann
> On 20 Feb 2016, at 11:59, Quincey Morris > wrote: > > On Feb 19, 2016, at 20:43 , Gerriet M. Denkmann wrote: >> >> This: >> UIDevice *theDevice = [UIDevice currentDevice]; >> NSLog(@“%s NSUInteger %lu bytes on %@“,__FUNCTION__, >> sizeof(NSUInteger), theDevice.localizedModel); >

Re: Can an NSArray ever have a count of -1?

2016-02-19 Thread Quincey Morris
On Feb 19, 2016, at 20:43 , Gerriet M. Denkmann wrote: > > This: > UIDevice *theDevice = [UIDevice currentDevice]; > NSLog(@“%s NSUInteger %lu bytes on %@“,__FUNCTION__, > sizeof(NSUInteger), theDevice.localizedModel); > > prints: > -[AppDelegate application:didFinishLaunchin

Re: Can an NSArray ever have a count of -1?

2016-02-19 Thread Gerriet M. Denkmann
> On 20 Feb 2016, at 11:24, Quincey Morris > wrote: > > On Feb 19, 2016, at 19:00 , Gerriet M. Denkmann wrote: >> >> I use Other C Flags: -DNS_BUILD_32_LIKE_64=1 > > AFAIK this is a Mac-only thing. I don’t believe it works on a 32-bit iOS > platform, in particular because I don’t believe th

Re: Can an NSArray ever have a count of -1?

2016-02-19 Thread Quincey Morris
On Feb 19, 2016, at 19:00 , Gerriet M. Denkmann wrote: > > I use Other C Flags: -DNS_BUILD_32_LIKE_64=1 AFAIK this is a Mac-only thing. I don’t believe it works on a 32-bit iOS platform, in particular because I don’t believe there are any 64-bit system frameworks on such a system. There’d be a

Re: Can an NSArray ever have a count of -1?

2016-02-19 Thread Gerriet M. Denkmann
> On 20 Feb 2016, at 06:32,Charles Srstka wrote: > > > >> On Feb 19, 2016, at 4:29 PM, Jens Alfke wrote: >> >> NSInteger is a typedef of ‘long’ in 64-bit, and ‘int’ in 32-bit. >> You’re correct that %d should be used for NSInteger in 32-bit. > > The recommended way to use an NSInteger, as p

Re: Can an NSArray ever have a count of -1?

2016-02-19 Thread Marco S Hyman
>> On Feb 19, 2016, at 4:29 PM, Jens Alfke wrote: >> >> NSInteger is a typedef of ‘long’ in 64-bit, and ‘int’ in 32-bit. >> You’re correct that %d should be used for NSInteger in 32-bit. > > The recommended way to use an NSInteger, as per Apple documentation, is to > use %ld and explicitly cas

Re: Can an NSArray ever have a count of -1?

2016-02-19 Thread Charles Srstka
> On Feb 19, 2016, at 4:29 PM, Jens Alfke wrote: > > NSInteger is a typedef of ‘long’ in 64-bit, and ‘int’ in 32-bit. > You’re correct that %d should be used for NSInteger in 32-bit. The recommended way to use an NSInteger, as per Apple documentation, is to use %ld and explicitly cast it to lon

Re: Can an NSArray ever have a count of -1?

2016-02-19 Thread Sean McBride
On Fri, 19 Feb 2016 14:29:03 -0800, Jens Alfke said: >(Here’s one reason NSInteger sucks: the difference in sizes doesn’t make >sense for values that don’t refer to memory sizes. For example, is it OK >use NSUInteger to store a file size? In a 64-bit process, sure! In a 32- >bit one, you’ll be fin

Re: Can an NSArray ever have a count of -1?

2016-02-19 Thread Jens Alfke
> On Feb 19, 2016, at 1:44 PM, Jean-Daniel Dupas wrote: > > Not exactly. %d is for 32 bit signed integer, Not exactly ;) %d is for “int”, whose size is unspecified. It does happen to be 32 bits on Apple platforms with current compilers. (I still remember the “fun” period of the early ‘90s whe

Re: Can an NSArray ever have a count of -1?

2016-02-19 Thread Jim Adams
It really was the wrong format specifier. Turns out the crash was on the next line where I used %d and %@ together. The -1 was an indicator of the issue but not the cause of my crash. Thanks for the quick look. I will try that warning flag. I haven’t changed any of those flags so it may very we

Re: Can an NSArray ever have a count of -1?

2016-02-19 Thread Jean-Daniel Dupas
> Le 19 févr. 2016 à 22:29, Jens Alfke a écrit : > > >> On Feb 19, 2016, at 1:17 PM, Jim Adams wrote: >> >> SLogInfo(@"Starting csi %ld count %d", csi, sortedEvents.count); >> >> In the console I see: >> INFO: Starting csi -1 count -1 >> The very next line crashes when the sortedEv

Re: Can an NSArray ever have a count of -1?

2016-02-19 Thread Sandor Szatmari
Jim, > On Feb 19, 2016, at 16:17, Jim Adams wrote: > > I have code that looks like the following: > > NSArray *sortedEvents = [events.eventSet sortedArrayUsingDescriptors:[NSArray > arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"date" > ascending:YES]]]; >int64_t csi =

Re: Can an NSArray ever have a count of -1?

2016-02-19 Thread Jens Alfke
> On Feb 19, 2016, at 1:17 PM, Jim Adams wrote: > >SLogInfo(@"Starting csi %ld count %d", csi, sortedEvents.count); > > In the console I see: > INFO: Starting csi -1 count -1 > The very next line crashes when the sortedEvents are accessed. What could > cause the array to have a -1

Can an NSArray ever have a count of -1?

2016-02-19 Thread Jim Adams
I have code that looks like the following: NSArray *sortedEvents = [events.eventSet sortedArrayUsingDescriptors:[NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"date" ascending:YES]]]; int64_t csi = -1LL; SLogInfo(@"Starting csi %ld count %d", csi, sort

Re: Breakpoints: Swift Error

2016-02-19 Thread Quincey Morris
On Feb 19, 2016, at 11:20 , Eric E. Dolecki wrote: > > Yes, it's in the AVAudioPlayer init. Which is a very interesting fact, because it suggests that the frameworks are using Swift code. I wasn’t aware that Apple had begun using Swift in actual frameworks yet, but I guess it had to start some

Re: Breakpoints: Swift Error

2016-02-19 Thread Eric E. Dolecki
Yes, it's in the AVAudioPlayer init. I do have a catch, and it never gets there. Things stop on that player instantiation. I've turned the breakpoint off for now and things seem to be working perfectly. I have a post on the Apple Dev Forum about it as well. Thanks for your input! On Fri, Feb 19, 2

Re: Breakpoints: Swift Error

2016-02-19 Thread Quincey Morris
On Feb 19, 2016, at 10:45 , Eric E. Dolecki wrote: > > I have an app where I have a breakpoint set for Swift Error. If it's on and > I run the debug app, I get the breakpoint for a crash. > > try player = AVAudioPlayer(contentsOfURL: url) What, according to the backtrace, is the point of the er

Breakpoints: Swift Error

2016-02-19 Thread Eric E. Dolecki
I have an app where I have a breakpoint set for Swift Error. If it's on and I run the debug app, I get the breakpoint for a crash. try player = AVAudioPlayer(contentsOfURL: url) The url is fine. If I turn the breakpoint off, it runs and debugs perfectly fine. Could this be a bug in Xcode? Is ther