On 11/17/2014 10:17 AM, Scott Talbert wrote: > 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.
That's fair. I'm cool with that. Not terribly efficient, but that's not exactly our goal either. :) I wonder how often do we not know the size of the string. Only in the HTTP handling, right? -- Phil Dibowitz p...@ipom.com Open Source software and tech docs Insanity Palace of Metallica http://www.phildev.net/ http://www.ipom.com/ "Be who you are and say what you feel, because those who mind don't matter and those who matter don't mind." - Dr. Seuss
signature.asc
Description: OpenPGP digital signature
------------------------------------------------------------------------------ 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