Thomas Martitz wrote:
> Perhaps
> 
> void lcd_puts(int x, int y, const char* text);
> void lcd_putsf(int x, int y, const char* fmt, ...);
> void lcd_putsf_ex(int x, int y, int xcrop, int style, bool scrolled,
> const char* fmt, ...);

Having both lcd_puts and lcd_putsf gives no advantage, on arm anyway. A call to 
lcd_putsf() with only the fmt parameter produces identical code as a call to 
lcd_puts(): 

void argtest(void)
{
    lcd_puts(0, 0, "foo");
    lcd_putsf(0, 0, "foo");
}

000040c4 <argtest>:
    40c4:       e92d4010        push    {r4, lr}
    40c8:       e59f4024        ldr     r4, [pc, #36]   ; 40f4 <argtest+0x30>
    40cc:       e3a00000        mov     r0, #0
    40d0:       e1a01000        mov     r1, r0
    40d4:       e1a02004        mov     r2, r4
    40d8:       eb0180ee        bl      64498 <lcd_puts>
    40dc:       e3a00000        mov     r0, #0
    40e0:       e1a01000        mov     r1, r0
    40e4:       e1a02004        mov     r2, r4
    40e8:       eb0180f2        bl      644b8 <lcd_putsf>
    40ec:       e8bd4010        pop     {r4, lr}
    40f0:       e12fff1e        bx      lr
    40f4:       0009c098        .word   0x0009c098

However there is certainly a point in not requiring all arguments all the time, 
so two functions make sense. Since they are vararg enabled, I'd say a more 
suitable name than lcd_puts is lcd_printf and its extended companion 
lcd_xprintf.

-- 
Björn

Reply via email to