Re: nil messaging? Is it safe?
Re: nil messaging? Is it safe?
- Subject: Re: nil messaging? Is it safe?
- From: Simon Stapleton <email@hidden>
- Date: Fri, 27 Sep 2002 18:14:19 +0200
From: Greg Parker <email@hidden>
Reply-To: email@hidden
<snippage>
* id, pointer, int: returns 0 or nil
* float, double: returns some random value
* long long (8 bytes): returns some random value with the 4 least-
significant bytes zero
* structs: returns some random value.
The undocumented zero value for int return probably won't change any
time
soon, because too much code depends on this. Be wary of float, double,
and
long long results, which are definitely not set to zero even though
int is.
Hmmm.
float and double are both of size 4, are they not, so if there is 4
bytes of zero being returned they should also have their bytes set to
zero as a part of the assignment, no?
i.e. should not
float var = [nil someMessage];
result in the four bytes of zero in variable var?
The following simple test, seems to imply that the value of a zero int
is equivalent to a zero float or double:
[localhost:~] simon% more test.c
#include <stdio.h>
main ()
{
union {
int a;
float b;
double c;
} test;
test.a = 0;
printf ("%f\n", test.b);
printf ("%f\n", test.c);
}
[localhost:~] simon% cc test.c
[localhost:~] simon% ./a.out
0.000000
0.000000
I fail to see how this is random, although I can see how it is destined
to failure on platforms where float and double aren't magically 4 bytes
long (or, to be more general, the same size as the number of zero bytes
returned). I must have missed something here, I feel.
<more snippage>
** disclaimer: Apple does not actually have a ninja hit squad, at least
not one that listens to my orders.
Drat. I was pretty much finished reverse-engineering
NeuralInterface.framework found in 10.2.1, so I could use it in
ANHSControl.app (rather clever really, uses Rendezvous to pick up the
most senior Apple person online at a given time, and implants
subliminal suggestions as to who the ANHS should be sent after next).
And I had such a _big_ list of targets, too.
Lesson learned. Never assume your favourite fruit company has a ninja
hit squad.
Still, it's not work wasted, as I can use the majority of this work in
CMWABMIMITAST.saver[1], but the really hard work will be getting my
wife close enough to the screen for it to take effect.
Simon
[1] "Convince My Wife A Big Motorbike Is More Important Than A Septic
Tank"
--
PGP Key Id : 0x50D0698D
--
Well, we finally have an indoor toilet. But what new disasters have
struck the Alpenproject?
Find out at : <
http://www.tufty.co.uk/Move/index.html>
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.