[gmx-developers] A question about 'enum' datatype in Gromacs, ask for help

Yukun Wang wangykoo at gmail.com
Fri Mar 11 15:25:21 CET 2011


Hi,
I am recently reading the GMX src-code for some need. I notice there are
many 'enum' typy defination in the 'enums.h' file. They are just like this:

...
enum {
  epbcXYZ, epbcNONE, epbcXY, epbcSCREW, epbcNR
};

enum {
  etcNO, etcBERENDSEN, etcNOSEHOOVER, etcYES, etcANDERSEN,
etcANDERSENINTERVAL, etcVRESCALE, etcNR
};
...

However in the standard C, enum type should be defined like ' enum
enumtypename { Sum, Mon,...,Sat } enumname1 ' .
For the GMX code above I don't understand how it is work?

I also notice there is a note ' /* note: these enums should correspond to
the names in gmxlib/names.c */' ,
...
const char *epbc_names[epbcNR+1]=
{
  "xyz", "no", "xy", "screw", NULL
};

const char *ens_names[ensNR+1]=
{
  "Grid","Simple", NULL
};
...
I just don't know how the two files are matched automatically. Is any
suggestion about this?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://maillist.sys.kth.se/pipermail/gromacs.org_gmx-developers/attachments/20110311/c0025523/attachment.html>


More information about the gromacs.org_gmx-developers mailing list