[fpc-devel] Program too long ?

Bernd Oppolzer bernd.oppolzer at t-online.de
Thu Jan 14 22:27:47 CET 2016

Jonas Maebe schrieb:
> On 14/01/16 17:45, Mathias wrote:
>> The code is machine generated.
>> I wanted to test which compiler is faster, the. Of FPC or C ++
>> C ++ could compile the code without errors.
> Whether or not it can be compiled is unrelated to the language of 
> course, but to the compiler. We indeed only develop FPC for use with 
> procedures that don't have an extreme size, because that way the 
> compiler uses less memory and is faster. Since such massive routines 
> are often indeed only present in case of machine-generated code, and 
> since in that case you can usually easily adapt your generation to 
> split up the code in multiple routines, there's not much incentive to 
> change this (other than being able to say "yes, we can handle this").
> Jonas

Some history:

The original Pascal compiler (Wirth in the 1970s) also had such an error 
"procedure too long"; this is a well known issue for almost all compiled 
and such limits hit you most of the time much earlier than physical 
limits or storage

The very early versions of Turbo Pascal had the problem that the 
generated code
had to fit in a 64 kB segment, so if you wanted to write programs of, 
say, more than
2000 lines, you had to break it up into several overlays. And this was 
another kind
of restriction, not depending on the size of individual procedures, but 
on the size
of the generated code of all procedures belonging to one overlay 
alltogether. When
designing your overlays carefully, you could write very large programs, 
but you had
to make sure, that calls occured only inside each overlay or from the 
into the overlay, but not across overlays. So the grouping of procedures 
into the
overlays was tricky sometimes.

Pascal/VS on the IBM mainframe threw the error message "procedure too 
when the size of the generated code for the procedure exceeded 8 k, that 
was the
size covered by two base registers. That was about 500 lines only. This 
way you
were forced to split your procedures and functions very eary. But there 
was virtually
no limit on the overall size of the program.

Kind regards


More information about the fpc-devel mailing list