Hello world.
I understood pointers in c, also pointer arighmetic in c, when I started learning assembly. I saw that a compile-time-known-table-in-c generated element acces code different that a pointer. Pointer in c needed a dereference. At least one instruction more in x86. To you all: make some simple examples and generate assembly code from *.c files. Then see how it is done in asm by your compiler.
It was like lux-veritatis for me. After I understood this, I stop investigating asm, and started to make really magic c programs using pointer arithm. Tables, no, no more. Linked lists ? – double dereference. List scanning – simple for loop with double dereference (first element of node is pointer to another node.) Use C casting from (Some_node_t *) to (void *) and make your code fly. Greets.
Hello world.
I understood pointers in c, also pointer arighmetic in c, when I started learning assembly. I saw that a compile-time-known-table-in-c generated element acces code different that a pointer. Pointer in c needed a dereference. At least one instruction more in x86. To you all: make some simple examples and generate assembly code from *.c files. Then see how it is done in asm by your compiler.
It was like lux-veritatis for me. After I understood this, I stop investigating asm, and started to make really magic c programs using pointer arithm. Tables, no, no more. Linked lists ? – double dereference. List scanning – simple for loop with double dereference (first element of node is pointer to another node.) Use C casting from (Some_node_t *) to (void *) and make your code fly. Greets.