Recent

Author Topic: Dumb Problems Contest!  (Read 463 times)

Curt Carpenter

  • Hero Member
  • *****
  • Posts: 699
Dumb Problems Contest!
« on: December 06, 2025, 08:30:06 pm »
Getting toward the new year, so I invite everyone to submit their "Dumbest Debug Problem of the Year" -- something that took a ridiculous amount of time to figure out, and turned out to be really dumb. 

I'll go first.

I spent a day trying to figure out why my statement
Code: Pascal  [Select][+][-]
  1. CopyToSymbDel(s,',')
  2.  

in the StrUtils unit just would not compile despite multiple readings of the docs, examination of the source,  building a minimal test program for the statement, and finally asking for help here on the forum.

After a frustrating day, I finally realized that the correct statement is

Code: Pascal  [Select][+][-]
  1. Copy2SymbDel(s,',').
  2.  

My brain just would not accept the "2" instead of the "to" no matter how many times I read it or typed it  :)  (Pretty sure this sort of problem gets worse with age too!)

Bart

  • Hero Member
  • *****
  • Posts: 5668
    • Bart en Mariska's Webstek
Re: Dumb Problems Contest!
« Reply #1 on: December 06, 2025, 11:08:05 pm »
Just stared appr. 15 minutes at a compiler error stating: "; expected, but else found".
That piece of code looked like:
Code: Pascal  [Select][+][-]
  1.       ...
  2.     end;//case
  3.   end//some condition
  4.   else
  5.   begin
  6.     ...
To satisfy the compiler I (desperately, and knowing this could not be OK) I added the requested semicolon before the "else".
Same errormessage.

In the end it turned out to be a misplaced "if condition then":
Code: Pascal  [Select][+][-]
  1.   begin
  2.     if condition then
  3.      case something of
where it should have been
Code: Pascal  [Select][+][-]
  1.   if condition then
  2.   begin
  3.     case something of

All this an a function spanning 3 or more screens with several "if then else if" and case statements.

Bart
« Last Edit: December 07, 2025, 11:15:47 pm by Bart »

Thaddy

  • Hero Member
  • *****
  • Posts: 18712
  • To Europe: simply sell USA bonds: dollar collapses
Re: Dumb Problems Contest!
« Reply #2 on: December 07, 2025, 02:41:59 pm »
Worst I have seen in the past year is screwing up exitproc management:
Code: Pascal  [Select][+][-]
  1. {$mode delphi}{$H+}// needs 3.3.1
  2. procedure ScrewUp;
  3. begin
  4.   writeln('Happy holidays')
  5. end;
  6.  
  7. begin
  8.   AddExitProc(procedure begin writeln(', world');end);
  9.   AddExitProc(procedure begin write('Hello');end);
  10.   // please kill the exitproc chain...<sigh>
  11.   ExitProc := @ScrewUp; //<---WTF
  12. end.
Thank you for wasting my time, Culprit...You know who you are.

(Well at least this does not print the dreaded one.. :-X ;D but it also causes leaks)
« Last Edit: December 08, 2025, 11:23:14 am by Thaddy »
If Europe sells their USA bonds the USD will collapse. Europe can affort that given average state debts. The USA can't affort that. Just an advice...

 

TinyPortal © 2005-2018