Re: Weird error with structs and @try/@catch
Re: Weird error with structs and @try/@catch
- Subject: Re: Weird error with structs and @try/@catch
- From: Uli Kusterer <email@hidden>
- Date: Thu, 11 May 2006 12:34:11 +0200
Am 11.05.2006 um 03:47 schrieb Glen Simmons:
On May 10, 2006, at 8:32 PM, Shaun Wexler wrote:
On May 10, 2006, at 6:29 PM, Glen Simmons wrote:
This is a bug, for sure... but for a workaround, can't you just
recast it?
[self foo:(NSRect)aRect];
Nope, that recast has no effect. Is there a way to cast away the
volatile-ness?
Try this instead:
[self foo:*(NSRect *)&aRect];
Yep, that works. But boy is it ugly. :)
A good idea would be to do a #define for that:
#define CAST_AWAY_VOLATILE(var) (*(typeof(var) *) &var)
then you can write:
[self foo: CAST_AWAY_VOLATILE(aRect) ];
And you'll actually know what you were doing back then. For the
"why", you'd probably want to add a comment mentioning you're working
around that particular error message.
Though I feel kinda bad just casting away volatile-ness. Anyone
remember what that did and why it's safe to just cast it away?
Cheers,
-- M. Uli Kusterer
http://www.zathras.de
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden