[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: some unsigned/NSInteger to NSUInteger changes in -gui
From: |
David Chisnall |
Subject: |
Re: some unsigned/NSInteger to NSUInteger changes in -gui |
Date: |
Tue, 10 Apr 2012 17:36:56 +0100 |
Hi Sebastian,
On 10 Apr 2012, at 17:27, Sebastian Reitenbach wrote:
> I thought one of the goals is to be more compatible with Coocoa, and there
> its an NSUInteger. therefore I decided to follow your first suggestion,
> bumping the NSTabView class version, and add a check to the decoder method.
> There is already another check for version < 2.
> The patch below now again makes the broken Apps work for me.
>
> Is that OK, or is there more that would need to be fixed?
As someone else said, please consider using @encode(int) instead of "i" and
@encode(NSUInteger) instead of "l". The former is a style thing, the later is
just wrong - NSUInteger is a typedef and may not always be l (long). For the
current version, I had a macro version somewhere that was defined as:
#define DECODE(x) [aDecoder decodeValueOfObjCType: @encode(__typeof__(x)) at:
&(x)]
You then just write:
DECODE(_draws_background);
DECODE(_truncated_label);
DECODE(_selected_item);
and so on.
Your legacy compatibility code is also subtly wrong. If int is 32 bits and
NSInteger is 64 bits then this is broken on big-endian platforms. You should
instead write:
if (version < 3)
{
int tmp;
[aDecoder decodeValueOfObjCType: @encode(int) at: &tmp];
_selected_item = tmp;
}
else
...
David
-- Send from my Jacquard Loom
- some unsigned/NSInteger to NSUInteger changes in -gui, Sebastian Reitenbach, 2012/04/09
- Re: some unsigned/NSInteger to NSUInteger changes in -gui, Fred Kiefer, 2012/04/09
- Re: some unsigned/NSInteger to NSUInteger changes in -gui, Eric Wasylishen, 2012/04/09
- Re: some unsigned/NSInteger to NSUInteger changes in -gui, Fred Kiefer, 2012/04/09
- Re: some unsigned/NSInteger to NSUInteger changes in -gui, Sebastian Reitenbach, 2012/04/10
- Re: some unsigned/NSInteger to NSUInteger changes in -gui, Wolfgang Lux, 2012/04/10
- Re: some unsigned/NSInteger to NSUInteger changes in -gui, Sebastian Reitenbach, 2012/04/10
- Re: some unsigned/NSInteger to NSUInteger changes in -gui,
David Chisnall <=
- Re: some unsigned/NSInteger to NSUInteger changes in -gui, Sebastian Reitenbach, 2012/04/10
- Re: some unsigned/NSInteger to NSUInteger changes in -gui, David Chisnall, 2012/04/10
- Re: some unsigned/NSInteger to NSUInteger changes in -gui, Sebastian Reitenbach, 2012/04/10
- Re: some unsigned/NSInteger to NSUInteger changes in -gui, Fred Kiefer, 2012/04/10
- Re: some unsigned/NSInteger to NSUInteger changes in -gui, David Chisnall, 2012/04/10
- Re: some unsigned/NSInteger to NSUInteger changes in -gui, Sebastian Reitenbach, 2012/04/11