Re: [netcdf-hdf] goofy question: can you guarantee that you will not use an hid_t with a value of zero?

NOTE: The netcdf-hdf mailing list is no longer active. The list archives are made available for historical reasons.

  • To: Ed Hartnett <ed@xxxxxxxxxxxxxxxx>
  • Subject: Re: [netcdf-hdf] goofy question: can you guarantee that you will not use an hid_t with a value of zero?
  • From: Quincey Koziol <koziol@xxxxxxxxxxxx>
  • Date: Sun, 13 Jul 2008 14:19:54 -0500
Hi Ed,

On Jul 13, 2008, at 7:55 AM, Ed Hartnett wrote:

Howdy HDF5 Programmers!

The common view holds "there is no such thing as a stupid question."

I have personally found this to be profoundly untrue. *Most* questions
are stupid. Including (even especially) my own. And here is another
one to add to the total:

Can you guarantee that you will not us a zero as a valid hid_t?

In your H5Fcreate docs, for example, you say:

     Returns a file identifier if successful; otherwise returns a
     negative value.

But what about zero? According to this definition, zero would be a
valid file ID, and might be returned by H5Fcreate.

Is this intentional? Or did you just forget to write that all IDs will
be greater than zero?

As you know, there are many conveniences associated with zero in C,
but I cannot use them in the case of HDF5 IDs, because I have to worry
that zero might be a valid value. So a little clarification of your
documentation would allow me to clean up my code a bit.

Well, yes, we won't return 0 for an hid_t from a function. However, we _do_ use 0 for the "default" value for hid_t's (H5P_DEFAULT is 0, for instance), so it is a "valid" value for an hid_t. So, although we don't return the "default" value from any routines currently (only accepting it as an input parameter) and I don't think we ever shall, it's possible to receive it from the user application.

        Hope that helps you,

  • 2008 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-hdf archives: