Talk:Copy-and-paste programming: Difference between revisions

Content deleted Content added
m Loop unrolling etc: -- compiler
Phresnel (talk | contribs)
Line 57:
I did preserve the mention of loop unrolling, since that seemed to me to be the most significant point raised. There could be further discussion of loop unrolling in the body of the article, although the statement that it is "a common practice to gain speed increase on modern computers" is egregiously untrue. In fact, manual loop unrolling has become all but extinct in the modern era as improvements in compiler technology have removed the need for programmers to pursue these types of "speed hacks".
--[[User:Rnickel|Rnickel]] ([[User talk:Rnickel|talk]]) 17:33, 30 July 2013 (UTC)
 
== Writing swap by hand is common? Where exactly? ==
 
The paragraph http://en.wikipedia.org/wiki/Copy_and_paste_programming#Example claims that
 
"While this can be abstracted into a macro or a function, this adds considerable overhead and reduces readability of the code (see snippet example), as this is a common idiom."
 
This needs citation, and it is not true. In the C++ community, for example, it is common to use the std::swap-function. Even more, when writing classes, it is common to provide non-throwing swap functions. Even more more, std::swap is assumed to not throw and used as the foundation for enabling exception save code.
 
Handwriting swap is totally counterproductive in C++ and textbook saying you should handwrite should be thrown away. Both because it is less readable than the word "swap", and because it opens loopholes in a program's exception safetyness.
 
[[User:Phresnel|Phresnel]] ([[User talk:Phresnel|talk]]) 15:22, 20 August 2013 (UTC)