|
|
|
|
|
by feral
5580 days ago
|
|
I've been trying to figure out what he was getting at, as well.
The original article, by Elliotte, seems to have updated the code snippet to: '
String s = "";
for (int i = 0; i < args.length; i++) {
s += args[i];
}
' I deduce from this that the error was in the copy/paste. The line that was supposed to be changed to 's+= args[i]' was accidentally left as 's+= array[i]' As such, its a simple failure to replace all instances of 'array' in the pasted code, rather than anything to do with 'operator overloading', or even to do with checking if 'array[i]' was out of bounds - there is simply no variable 'array' supposed to be in that context. I wish Turoff had been less obtuse about it, especially as the original Elliotte post seems to have been silently updated. |
|
If 'the bug' is just a copy/paste problem of a variable that doesn't exist in that scope, then compilation will fail at that point, so again, I don't see how that could be the one that Turoff said would survive for weeks in the wild.