AI agents are good at producing code that compiles. With Delphi, "compiles" and "behaves the same" are far apart. Here are six behaviors I keep seeing agents get wrong — each one is measured on the Delphi 13 compiler, not recalled from memory.
1. Round is banker's rounding
Round(2.5) = 2 and Round(3.5) = 4 in Delphi: halfway cases go to the nearest even number. C#'s Math.Round does the same by default, but Java's Math.round(2.5) and C++'s std::round(2.5) return 3. A port to Java or C++ that maps Round to the "obvious" function changes every halfway result.
2. A unit can replace Round
If the last unit in uses declares its own Round , an unqualified Round(2.5) calls that one, not System.Round . An agent that reads the call site alone will port the wrong function.
3. Strings start at 1
S[1] is the first character of a Delphi string . Off-by-one errors appear in every loop and Copy call that is translated literally to 0-based indexing.
4.…