TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: PAUL DRUGGITT
from: JAVIER KOHEN
date: 1997-06-10 19:02:00
subject: Dynamic member testing [1/2]

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

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.