Originally Posted by
laserlight
Well, if you're not satisfied by the result of your own measurement, and would like a definitive answer from the standard in which inet_pton is defined, then the answer is: none of them are guaranteed to be the fastest; it depends on the implementation.
I tested with perf again and the elapsed time is not constant, running it couple times doesn't give me a close result to the previous one.
I'm still struggling with the first question. I understood that using & on a variable will give me the addess of it but not with the sizeof, how it works, why those are different? Could you explain it ? if not point a references please?
Code:
char x[4];
sizeof(x) -> gives 4
sizeof(&x) -> gives 8, why?
Code:
struct sockaddr_in sa;
sizeof(sa) -> gives 16, why?
sizeof(&sa) -> gives 8, why?
Code:
unsigned long x;
sizeof(x) -> gives 8, why?
sizeof(&x) -> gives 8, why?