Martin Gregorie wrote:
> However, I should hardly need to remind you that C and C++ programs
> aren't always exactly economical when it comes to load size: I remember
> looking at this a long time back when Borland compilers were still a
> thing. IIRC 'hello world' in ANSI C compiled to several 10s of Kbytes and
> the C++ version compiled to 800Kb using the then current version of
> Borland's finest.
pi@dev:~ $ uname -a
Linux dev 5.4.79-v7l+ #1373 SMP Mon Nov 23 13:27:40 GMT 2020 armv7l
GNU/Linux
pi@dev:~ $ gcc --version
gcc (Raspbian 8.3.0-6+rpi1) 8.3.0
pi@dev:~ $ clang --version
clang version 9.0.1-6+rpi1~bpo10+1
pi@dev:~ $ cat hello.c
#include
int main(void) {
printf("Hello, world.\n");
return 0;
}
pi@dev:~ $ gcc -Os -s hello.c -o hello-gcc-dyn
pi@dev:~ $ gcc -Os -s -static hello.c -o hello-gcc-stat
pi@dev:~ $ clang -Os -s hello.c -o hello-clang-dyn
pi@dev:~ $ clang -Os -s -static hello.c -o hello-clang-stat
pi@dev:~ $ ls -l hello-*
-rwxr-xr-x 1 pi pi 5624 jan 10 02:56 hello-clang-dyn
-rwxr-xr-x 1 pi pi 414860 jan 10 02:56 hello-clang-stat
-rwxr-xr-x 1 pi pi 5544 jan 10 02:55 hello-gcc-dyn
-rwxr-xr-x 1 pi pi 414820 jan 10 02:56 hello-gcc-stat
--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)
|