HDF5 1.6.10 and 1.8.4 release candidates are available for testing

I would be surprised if that differed across OSes.

Unfortunately it does.

Wow.

In Borland compilers (BDS 2006 and earlier, it
seems), the
documentation says:

-----------------------------------------------
Sends formatted output to a buffer of a maximum length specified by nsize.

If the number of bytes to output is:

< nsize, then all of the characters have been written, including the
terminating '\0' character.

== nsize, then nsize characters are written, with no terminating '\0'
character.

nsize, then only nsize characters are written, with no terminating

'\0' character.
If nsize is 0, then the string will not be written to (and may be NULL).

Return Value

Number of bytes output, or, if nsize is 0, the number of bytes needed,
not including the terminating '\0' character.
-----------------------------------------------

According to some web pages, snprintf was not standardized in C89/C90
but only in C99. So, it is a case of pre-C99 incompatibility.

For best compatibility, snprintf functions should be somehow secured (as
proposed in my previous email). This depends, of course, on the level of
determination to support pre-C99 compilation for HDF5. However, when
buffers are long enough, both functions work--so the most important
thing is to avoid deliberate use of the truncating capability of C99 as
that may vary between platforms.

But even with the broken behaviour you describe above, snprintf() is
better than sprintf(). You might be missing the null termination, but
at least you're not overwriting random memory! And if your compiler
adheres to a _10 year old_ standard, they you do get the null termination.

···

On 11/2/09 11:22 AM, Vesa Paatero said:

--
____________________________________________________________
Sean McBride, B. Eng sean@rogue-research.com
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada

why not using libiberty ot other such implementations?

···

On Mon, Nov 02, 2009 at 10:42:22AM -0500, Sean McBride wrote:

On 11/2/09 11:22 AM, Vesa Paatero said:

>> I would be surprised if that differed across OSes.
>
>Unfortunately it does.

--
Francesco P. Lovergine