On Mon, 17 Nov 2014, Phil Dibowitz wrote:

>> Surprisingly, C++ still doesn't have any built-in string formatting
>> mechanisms. There are a few libraries out there, but it seems like overkill 
>> to
>> add something like that. I was thinking about something like this (not yet
>> tested) to replace our sprintf's:
>
> Shouldn't simply moving to snprintf() solve the problem? I've been replacing
> sprintf() with snprintf() as I hit them, but clearly there's more.
>
> [disclaimer, I haven't dug through the stacktrace, I'm purely replying 
> to your comment about sprintf]

Yes, technically it would - but we'd still have to pick some arbitrary 
size for a buffer that we hope is large enough.  Then we'd have to check 
the return value of snprintf and if we ran out of space, we'd probably 
have to exit abnormally anyway.  That's really what I was trying to work 
around with my proposed format_string function - figure out the buffer 
size automatically and handle it.

Scott

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
concordance-devel mailing list
concordance-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/concordance-devel

Reply via email to