more enum questions...

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

Howdy all!

I have some more enum questions!

Looking at the HDF5 users guide, I see the following example:

hid_t hdf_en_colors = H5Tcreate(H5T_ENUM, sizeof(short));
short val;
      H5Tenum_insert(hdf_en_colors, "RED",   (val=0,&val));
      H5Tenum_insert(hdf_en_colors, "GREEN", (val=1,&val));
      H5Tenum_insert(hdf_en_colors, "BLUE",  (val=2,&val));
      H5Tenum_insert(hdf_en_colors, "WHITE", (val=3,&val));
      H5Tenum_insert(hdf_en_colors, "BLACK", (val=4,&val));

     H5Dcreate(fileid,spaceid,hdf_en_colors,H5P_DEFAULT);


I have three immediate questions:

1 - Why is H5Tenum_create not used?

2 - In the above case, how does HDF5 choose the underlying integer
type? Obviously it will be a short, but signed or unsigned? Big,
little, or native endian? Or does it not matter?

3 - What is this strage way of setting the value of val inside the
parameters to the function? In 20 years of C programming, I have never
seen this technique!

Thanks!

Ed

-- 
Ed Hartnett  -- ed@xxxxxxxxxxxxxxxx


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