#43 More strange behaviour of SDCC in strings

closed
nobody
None
5
2006-03-28
2006-03-09
Omar_Espinosa
No

Dear SDCC mates,
some days ago I reported a strange behaviour of SDCC.
It is well known that in any C/C++ compiler a string
character can be handled by arrays, pointers and
printf.

Tring to find out the reason of such a behaviour I
used the printf function. The rare behaviour is that
by using this option(printf and putchar routine) the
compiler created a ihx file with up 140 lines in
comparison to 40 lines in prior files using arrays,
pointers or strings.

I wonder if this is normal. If so, what kind of
compiler is this?

look my main routine and the putchar routine. Is
there anything wrong?

void main (void){
LCD_Init();
espera(10);
espera(2);
printf_small("WELCOME TO COFFEE\n");
Cmdwrite(0xC0,0); //command for second line
printf_small("ROASTER V.1.0\n");

}

void putchar(char c){
writedata(c,1);
espera(1);
}

Discussion

  • Maarten Brock
    Maarten Brock
    2006-03-13

    Logged In: YES
    user_id=888171

    It's normal. printf_small in printfl.c can easily create
    100 lines in a hex-file.

    What kind of compiler is this? One generating usable code
    for free, not necessarily the tightest.

    But in general using printf is always costly in terms of
    code space and speed on any small device / compiler. If you
    want smaller / faster code use printf_tiny or printf_fast.

     
  • Maarten Brock
    Maarten Brock
    2006-03-13

    • status: open --> pending
     
  • Logged In: YES
    user_id=1312539

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).

     
    • status: pending --> closed