Re: [AD] to prefix or not to prefix (part 2)

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


In reply to Vincent Penquerc'h <Vincent.Penquerch@xxxxxxxxxx>:
>> What's the difference?
>
>Removing the ability to do printf-like formatted output.

Yes, I got that bit :-)
I meant that the two functions would work in an identical manner (save
that you need to escape % symbols in the printf() version), so there is
no point having the non-printf() version (especially since the arguments
are in the same, very sensible order).

>Personally, I like it.

Erm... why?

> Unfortunately, this yet another place where
>Allegro either truncates the string or buffer overflows (the former,
>in this case). Trouble with printf-likes is to efficiently allocate
>the memory while being 100% safe and not waste too much memory.

Yes, this is very true. I have written a printf()-style function for C++
which constructs a `string' object, and is memory safe (and doesn't
waste a single byte). I wrote everything from scratch, including the
floating point renderer, so there is no chance of buffer overruns.

I could port it back to C (perhaps using Allegro's Unicode routines),
but it would be quite an undertaking, and error checking would be a
nightmare without exceptions. It is also a fair chunk of code.

Bye for now,
-- 
Laurence Withers, lwithers@xxxxxxxxxx
                http://www.lwithers.demon.co.uk/

Attachment: signature.asc
Description: PGP signature



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/