Hi,

On Sun, Jun 29, 2014 at 8:02 AM, Zbigniew <zbigniew2...@gmail.com> wrote:
> 2014-06-29 14:04 GMT+02:00, Tom Ehlert <t...@drivesnapshot.de>:
>
>> Most probably because you use printf().

Most C programs use printf (or sprintf, etc.) a fair bit. Very rarely
can you say, "Well, I don't need it."

> It seems, not too much I can do about this using Turbo C:
>
> 1. Compilation of "Hello, world!" containing "printf" gave around 370
> bytes for OBJ, and 8.3k for EXE.
> 2. The same when replaced "printf" with "puts" gave 6.4k for EXE.
>
> Yes, the difference is noticeable - still it's not as big, as one could 
> expect.
>
> Probably Watcom compiler is able to produce smaller binary, but I
> didn't try it yet.

For a simple hello world? "wcl /otxn" gives this:   puts = 4704, printf = 8628

For one really really simple app of mine, I only needed printf("%ld"),
hence I rolled my own (in C). "wcl /otxn" gives me this:
printf=25120, outint=21722.

> Who knows, maybe for Turbo C the best solution for this would be to
> code one's own simplified "puts" directly in assembly.

As Tom mentioned, prf.c is probably your friend here. But simple stuff
like converting / printing unsigned longint (8086 asm) is not
difficult (nor large, obviously). Of course, if you want to mix that
with C, you'll have to take into account the calling convention (e.g.
OpenWatcom is register by default, but stack can also be used).

------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
Freedos-user mailing list
Freedos-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-user

Reply via email to