Javier Kohen to Druggitt. Ensign:
On stardate 04-Jun-97, Paul Druggitt established a sub-space link to Cliff
Rhodes refering to Dynamic member testing [1/2].
PD> I got plenty of ideas, but couldn't quite grasp the 'mechanics' of
if (*(int *)a >> *(int *)b).
It instructs the compiler (by using a cast) that a & b both point to an
int value. Then it gets the values that a & b are pointing to, and
shifts *a *b places to the right, and tests if it's a non-zero value.
splitting the code in bits...
char *a = "abcde";
char *b = "fghij";
int *aa;
int *bb;
aa = a; // here we cast the char * to int *
bb = b;
int n;
int i;
n = *aa; // Then we get the values the pointers are pointing to
i = *bb;
int m;
m = n >> i;
if (i != 0) {
}
Internet: jkohen@tough.com þ Fidonet: 4:900/748.3 þ Sk-Network: 200:201/201.2
Rockernet: 33:300/100.3 þ Javier Kohen/The_Crusher þ PGP keyID: 3423EAA9
... Solo en la cama, mirando al techo, sin un amigo con un Resero; pero por
eso no he de sufrir, con un vinito soy feliz þ Flema
-!- CrusherTag 0.021.
--- Terminate 4.00/Pro
4:900/748.3)
---------------
* Origin: The King of The Ring BBS þ +54-1-OFF-LINE þ TLD 0 - 7
|