- Surge Strip
- Nov 2, 2005
-
Takin' hits
|
Our intern programmer makes me laugh some days. For example, he future proofed all his code, just in case the definition for a newline ever changes on Windows:
He codes mostly in Delphi, which has quite a few functions for you to use. I guess he just didn't like the Uppercase function they wrote:
code:function Upercase(str : string) : string;
var
len : integer;
count : integer;
newstring : string;
begin
len := length(str);
count := 0;
while (count < len) do
begin
newstring[count] := str[count] - 32;
count := count + 1;
end;
result := newstring;
end;
So many things wrong. He even got an error that Uppercase was already defined, and so he misspelled it.
|
#
¿
Apr 1, 2008 03:09
|
|
- Adbot
-
ADBOT LOVES YOU
|
|
#
¿
May 7, 2024 18:49
|
|
- Surge Strip
- Nov 2, 2005
-
Takin' hits
|
Another one I found today. Apparently the programmer did not know that the TListBox in C++ Builder has an ItemIndex property, which, oddly enough, will tell you what item is selected!
code:for (cnt = 0; cnt < ListBox->Count; cnt++)
{
if (ListBox->Selected[cnt])
{
/*stuff with cnt*/
break;
}
}
Also, classes that abuse OOP principles. Next to no private members, and worst of all, all the data is in public pointers, that have no documentation.
|
#
¿
Apr 11, 2008 05:17
|
|