[comp.sys.amiga] Hidden printf/puts calls in c.lib functions?

john13@garfield.UUCP (John Russell) (04/02/88)

I wanted to trim down the size of a program (~12K compiled) by eliminating
calls to printf and puts and using their ARP equivalents. I found I could save
2K by doing this is a "hello world" program that used printf, but there wasn't
any real savings when I changed my larger program over.

My question: do other Aztec C functions contain calls to them hidden away?
If so is there a way around that limitation? The DOS calls that are still
used in the program are fopen, fread, fseek, fclose. All references to
printf, puts, and fprintf have been replaced by ARP equivalents.

John

ain@s.cc.purdue.edu (Patrick White) (04/04/88)

In article <4637@garfield.UUCP> john13@garfield.UUCP (John Russell) writes:
>My question: do other Aztec C functions contain calls to them hidden away?
 [calls to printf and puts]

   I've only looked at a few Aztec C calls (getenv, setenv, and _main), but
a lot of them had printf's in them for error messages.

>If so is there a way around that limitation?

   Sure.. don't call library functions Manx'ish.. or get the source to the
libraries and change 'em.

-- Pat White
ARPA/UUCP: k.cc.purdue.edu!ain  BITNET: PATWHITE@PURCCVM  PHONE: (317) 743-8421
U.S.  Mail:  320 Brown St. apt. 406,    West Lafayette, IN 47906

rokicki@polya.STANFORD.EDU (Tomas G. Rokicki) (04/04/88)

>    I've only looked at a few Aztec C calls (getenv, setenv, and _main), but
> a lot of them had printf's in them for error messages.

I beg your pardon!  I've looked at *all* of the Aztec C calls, and I
don't believe I remember a single one with printf()'s in th.  puts()
yes, printf() no.

One minor thing---(3.4b, anyway)---setenv by itself increases the
size of your executable by 2372 bytes.

main() { getenv(); setenv(); } weighs in at 4700 bytes;
main() { getenv(); } weighs in at 2328 bytes.

Not too surprising, as there has to be a copy of the environment
library structure in there somewhere, but I think that still may
be a bit larger than it could have been.

-tom

shimoda@rmi.UUCP (Markus Schmidt) (04/09/88)

Hi!

With Manx I found the most sizesaving feature to use Open, Write
instead of fopen, fwrite. (Amigafunctions vs. Un*x).
Should save you about 6K.

|._,|   Cu
 - -    Markus
==O==   (shimoda@rmi.UUCP)
 `-'    Never trust a smiling cat!