I was reading a code of a middleware that is written in c and in the code they wrote the following:
usleep(6*1000*1000);
So my question is:
Is there a reason behind writing it like this? why not just write 6000000? Doing this multiplication has any effect on the performance of the program?
usleep()
expects the supplied argument to be in "microseconds".
This is a visual transformation of the microsecond to seconds, no impact on code expected as any half-decent compiler will compute that at compile time.
It just makes the source easier to read. With the multiplication, the number is obviously 6 million.
As it evaluates to a constant, the compiler will evaluate the constant at compile-time and there will be no difference in the compiled code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With