Open MPI logo

Hardware Locality Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Hardware Locality Development mailing list

Subject: [hwloc-devel] documentation/implementation questions with the snprintf routines
From: Guy Streeter (streeter_at_[hidden])
Date: 2011-01-06 11:13:10

The man pages for the various snprintf routines indicate that they return the
number of characters written. My testing indicates that they always return the
number of characters required, which can be more or less than the space supplied.
My testing also indicates that if the buffer size is indicated as zero, the
buffer pointer is not referenced. This allows me to pass in NULL and zero to
determine the required size before allocating the space. I would like to see
that explicitly promised so I can count on it going forward.