Maximum number of procedures in PRG files

Visual FoxPro stores procedures and methods of a PRG file in a rather unusalway. Instead of keeping methods with their classes, Visual FoxPro compiles onehuge list of all procedures in a PRG file. Each procedure is assigned a 16-bitID value. For this reason, the total number of procedures that can be stored ina PRG file is 65,535. It doesn't matter how many of them are methods or procedures.It's the total number of PROCEDURE and FUNCTION statements that counts. Here's a code sample that demonstrates this:

lc = "define Class test as custom" + Chr(13)+Chr(10)
lc = lc + ;
"Procedure proc"+Chr(13)+Chr(10)+"ENDPROC"+Chr(13)+Chr(10)
For t=1 to 65535
lc = lc + ;
"Procedure method"+Transform(t)+Chr(13)+Chr(10)+;
"ENDPROC"+Chr(13)+Chr(10)
EndFor
lc = m.lc + "ENDDEFINE"
StrToFile(lc,"testcode.prg")
Compile testcode.prg