On 10/13/2007 11:14 AM, Curtis Olson wrote:

> One thing to be a little careful about when coding is that it's easy to be
> tempted to check for the same error condition in multiple places or at
> multiple levels of the function call stack.  That's not always optimal and
> can lead to inconsistencies as the code ages, not to mention being a little
> suboptimal.  I'm not advocating any hard and fast rules here, but it's easy
> to become over paranoid and check result bounds way more than needed.

Since this is nominally a C++ project, why not use std::string
and boost::format, so that
  a) it is not necessary to be over-paranoid
  b) it is not necessary to be paranoid
  c) it is not necessary for humans to count things that the
   computer could have (and should have) counted
  d) it is not necessary to truncate things in cases where
   the human counted wrong.
  e) there won't be segfaults and security problems in cases
   where the truncation goes awry.
  *) et cetera.

If we're going to replace sprintf, why make a small improvement
(snprintf) instead of a big improvement (boost::format)?

I quote from
  http://www.boost.org/libs/format/doc/format.html

>> The <boost/format.hpp> format class provides printf-like formatting,
>> in a type-safe manner which allows output of user-defined types.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to