Open MPI logo

Hardware Locality Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |  

This web mail archive is frozen.

This page is part of a frozen web archive of this mailing list.

You can still navigate around this archive, but know that no new mails have been added to it since July of 2016.

Click here to be taken to the new web archives of this list; it includes all the mails that are in this frozen archive plus all new mails that have been sent to the list since it was migrated to the new archives.

Subject: Re: [hwloc-devel] documentation/implementation questions with the snprintf routines
From: Brice Goglin (Brice.Goglin_at_[hidden])
Date: 2011-01-06 11:29:28

Le 06/01/2011 17:13, Guy Streeter a écrit :
> 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.

Indeed, most comments in the API are wrong. All our snprintf functions
return the number of required characters.

> My testing also indicates that if the buffer size is indicated as
> zero, the buffer pointer is not referenced.

This is *mostly* true. We only have a couple corner cases that I should
be able to fix.

> 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.

Once I fix the aforementioned corner cases, we'll explicitly promise
this in the API comments. Should be ok for 1.1.