Name: Anonymous 2008-10-05 18:37
You heard me, bitches.
fprintf ("fast printf") instead of printf.++i is faster than both i++ and i = i + 1.void main(void) is faster than int main(void) or int main(int, char **) since no value needs to be returned to the OS.(a^=b^=a^=b swaps a and b) is faster than using a temporary. This works for all types (including structures), but not on all compilers. Some compilers may also give you a harmless warning.int i;
void func(void) { for (i = 0; i < 10; i++) ; /* ... */ }
void func2(void) { for (i = 0; i < 20; i++) ; /* ... */ }
/* ... */int arr[256];
size_t realsize;
for (realsize = 0; realsize <= SIZE_MAX; ++realsize)
if (!memset(arr, 0, realsize)) break;
/* now you know that arr actually has realsize / sizeof (int) elements */