[fpc-pascal] What's in Hello World

Karoly Balogh charlie at scenergy.dfmk.hu
Mon Jan 8 03:15:37 CET 2024


Hi,

On Sun, 7 Jan 2024, Ingemar Ragnemalm via fpc-pascal wrote:

> Just for comparison, I fired up Think Pascal and made Hello world!
>
> Plain Hello world, closes so quickly that you don't have time to see it: 4625 bytes.
>
> Including ShowText and while not Button do; 4639 bytes.
>
> Yes, less than 5k! Progress?

This isn't a fair comparison. Think Pascal is a single platform compiler,
which means it can avoid a bunch of abstraction layers, and also it
doesn't support many advanced modern Pascal constructs. Main examples are
AnsiStrings, and exception handling, but also the memory allocator is more
advanced, and thus bigger than the early Pascal compilers. Everything has
a trade off.

Also while this means the initial "bloat" is bigger, there's a lot less
added, as one progresses. I have a fully localized, multithreaded GUI
Amiga application written in Free Pascal, that is around 64KiB. I'm sure
it could be a lot smaller too, but it isn't unreasonable.
(Here: http://viaduct.amigaspirit.hu )

If anyone is curious what gets into a "Hello, World!" binary, feel free to
look into a linker map, by using command line argument -Xm. (Note on Linux
& systems using GNU LD, the linker map file starts with the _discarded_
sections, the ones which did not get into the binary, so look at the
bottom of the file.)

Charlie


More information about the fpc-pascal mailing list