I am in the process of writing a non-destructive transformation procedure in C, and I just realized that (at least in Visual C ++) functions are resolved in reverse order.
So:
main() { char* psString[] = { "Hello", "World", "World2", "World3" }; printf("%s - %s - %s - %s\n", H2A_N(psString[0]), H2A_N(psString[1]), H2A_N(psString[2]), H2A_0(psString[3])); return 1; };
My code is not repetitive and works in only one thread, so I was going to use a static array of characters to store the results.
My plan was to have a function H2A_0 that wrote the output to the beginning of the buffer and left the next address for subsequent calls to H2A_N.
I understand that there are some flaws in this approach, but I have to apply this conversion procedure to a lot of existing code, so the simpler the better (I don't want to interfere with freeing up memory).
My question is:
- Is it part of the C standard for solving functions (when they are passed as arguments to other functions) in reverse order.
- Is there a better way to do this?
source share