Re: question on _strrev by Jerry
Jerry
Mon May 10 21:28:11 CDT 2004
In article <IO-dnfEaA7C4uz3dRVn_iw@comcast.com>, m@msn.com says...
> That isn't shorter when it comes down the assembly and machine language.
> :-)
>
> It'll compile the same as the previous three line will.
That depends on the compiler, optimization, etc. Just for example,
with VC++ 7.1 with optimization turned off, the one I posted is
minutely shorter and more efficient. Even minimal optimization will
usually make the difference disappear though.
I'd also note that as posted, both contained one potential problem --
the call to swap passed *p and *q as the arguments. In C++, this
could be made to work by using pass-by-reference. In C, you'd have
to pass p and q as the parameters instead.
--
Later,
Jerry.
The universe is a figment of its own imagination.