[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: multiple string tokens
From: |
Eric Wasylishen |
Subject: |
Re: multiple string tokens |
Date: |
Wed, 17 Aug 2011 12:36:03 -0600 |
Hey,
I don't like using PRIdPTR because it took me a while to figure out why it
works (I had to look up that it's a format string for intptr_t, and then check
the NSInteger definition to verify that that is also intptr_t…), and PRIdPTR
introduces a dependency on how NSInteger is defined everywhere you use it.
Personally I always cast NSInteger/CGFloat to a c89 type when I need to print
them, since it will work on any Foundation implementation. Anyway, we just have
to make sure we never have (@"foo: %f", someCGFloat) or (@"foo: %d",
someNSInteger)!
Eric
On 2011-08-17, at 11:32 AM, Riccardo Mottola wrote:
> Hi,
>
> David is making many log statements more portable / 64 bit compliant by using
> a macro like this:
>
> NSLog(@"_dispatch with unexpected status %" PRIdPTR, [self
> streamStatus]);
>
>
> PRIdPTR will expand to the correct string.
>
> gcc 2.95 on my sparc box barks
>
> NSStream.m:198: syntax error before string constant
>
> I think, but it is just a guess, that for some reason @"" and "" don't get
> joined properly, while "" and "" do. Anyone has a better idea or some memory
> about old compiler quirks or generally another 32/64 bit option?
>
> Riccardo
>
> _______________________________________________
> Gnustep-dev mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/gnustep-dev