Basic function to macro

closed account (DGvMDjzh)
I want to turn this simple function into a macro.
Can anyone help me out?

1
2
3
4
5
unsigned int Len(const char* s) {
 unsigned int i;
 for(i = 0; s[i] != '\0'; i++);
 return i;
}


What is the advantage of using a macro when you can use a function?
Forced inlining in C.

Even then, you are wasting your time. Just use strlen(), which is highly optimized for your PC.
Topic archived. No new replies allowed.