Re: Stupid objective-c question
Re: Stupid objective-c question
- Subject: Re: Stupid objective-c question
- From: Britt Durbrow <email@hidden>
- Date: Mon, 26 Sep 2016 13:52:47 -0700
> On Sep 26, 2016, at 3:31 AM, Slipp Douglas Thompson <email@hidden> wrote:
>
> I'm sorry if I'm not up to snuff on compiler architecture, but how would a pointer to the memory address of that same pointer ever collide with any other pointer?
When ***Somebody*** is Doing It Wrong.
Having been bitten before by this phenomenon (i.e, others doing bizarre, illogical things; often in oddball close-source code libraries and/or drivers); I felt compelled to point out that non-collision wasn’t an *absolute* guarantee, but rather just a reasonable assumption *almost* always.
In other words, just when you think you’ve got it Idiot Proof, somebody goes and invents a better Idiot…
:-)
> Only one thing may exist at at time at a given memory address, so— yes, if you're assigning arbitrary values into a pointer instead of an actual valid memory address you could have a problem, but that usage in itself is the smell.
It’s not *you* - the good, sane programmer - who’s doing that. It’s the other guy who’s Doing It Wrong… but it shows up as misbehavior in *your* code, leading *you* to tear your hair out.
And yes, the malodorousness of that code is positively wretched… 8-p
Alternatively, a memory scribbler or leakage via an improperly initialized variable may induce similar misbehavior (so, one should not assume that just because it *shouldn’t* happen under sane circumstances, that it *can’t* when facing a bug).
:-)
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden