Great :D
Printable View
Great :D
Quote:
Thanks, I needed a chuckle.
I think we all do, is it just me or is the level of nit-picking (in general) get a tad silly? I don't know maybe it's just me.
;)
The functions posted are C++, using references. So first off its on the wrong board.Quote:
Originally Posted by treenef
The functions themselves contain undefined behavior, one being a classic example for use with describing sequence points. The second one is the version of what not to do.
And it might be presumed that they are 'better' because it's still the 1970s and memory is expensive, CPUs lack registers. Or it's just funny bacause it is likely done "for speed" and it likely generates more code.
> there may some error above.
There's some error below as well. Your division by 2 is a good idea if you're attempting an in-place reverse, but you're not, you're just copying half the string to the result.
> z=i/2; //or z=i>>1;
Special bonus points for whoever can spot why these two statements are NOT equivalent.
> is it just me or is the level of nit-picking (in general) get a tad silly?
The number of bogus and ill-conceived answers is certainly increasing.
Nit pick today, or post your code with segfaults tomorrow - your choice.
Quote:
Originally Posted by Salem
Where are my special bonus points? :DQuote:
The result of E1 >> E2 is E1 right-shifted E2 bit positions. If E1 has an unsigned type or if E1 has a signed type and a nonnegative value, the value of the result is the integral part of the quotient of E1 / 2^E2. If E1 has a signed type and a negative value, the resulting value is implementation-defined.
Wait... you did see my whited out text, now didn't you? Cos that was meant to be a joke. :)Quote:
The functions themselves contain undefined behavior, one being a classic example for use with describing sequence points. The second one is the version of what not to do.
And it might be presumed that they are 'better' because it's still the 1970s and memory is expensive, CPUs lack registers. Or it's just funny bacause it is likely done "for speed" and it likely generates more code.
No, I didn't. Sorry.Quote:
Originally Posted by treenef
Unfortunately someone else might not have seen it either. There are too many bad examples out there. I'd prefer it if they all had large bold garish banners surrounding them blinking DO NOT DO THIS.