On Jan 20, 2012, at 1:50 PM, Tom Browder wrote:

> On Fri, Jan 20, 2012 at 11:39, Christopher Sean Morrison <[email protected]> 
> wrote:
>> On Jan 20, 2012, at 12:12 PM, Tom Browder wrote:
> ...
>>> If we are not to use the standard C '*print*' functions due to memory
>>> considerations, why not start with the libc code (under LGPL license)
>>> and modify it as necessary?
>> 
>> What's there basically is exactly that though undoubtedly BSD heritage 
>> and/or pre-
> 
> Just glanced at the BSD version and it looks pretty clean and easy to
> follow (esp. compared to the GNU version).  I might take a stab at
> using it if it would be accepted.

BSD code is usually easier to follow due to the different development 
philosophies behind them.  Often does the same or less, but almost always more 
cleanly.  That said, I presume you mean looking at something like the guts of a 
modern vsprintf() for use inside bu_vls_vprintf()?

I wouldn't have any objection, but care would have to be taken to make sure 
it's got the same behaviors.  The implementation already passes the majority of 
the evaluation down to snprintf() and yet still has to accommodate 
cross-platform differences in implementations.   For example there's a rather 
large chunk in there specifically addressing the lack of %z support on Windows.

The reason it loops over the format string and handles the print specifiers 
individually ensures that the vls doesn't grow more than it has to and there's 
never an unhangled buffer overrun.

> (I also found lots of hatred from BSD toward GNU!  Probably some the
> other way, too--definitely some uncivil folks out there!)

It's bidirectional and spans decades.

Cheers!
Sean


------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
BRL-CAD Developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-devel

Reply via email to