David van der Spoel wrote:

> The mknb_func.coul is of another type (a subset of int) there you can 
> give its value to an integer, but not necessarily the other way around.
> I find it very unlikely that this would crash the program. 

The enum and int variables should be the same size so the
act of storing one in the other will not of itself crash
the program.  However subsequent code using that value could
easily result in a boom, in particular through an unhandled
enum case at higher optimization levels.  For instance, if the
compiler produces an object something like this pseudocode:

 /* no check for enum range */
    a=b;  /*a is enum range 0->6 but b 20 */
    jumpto offset + a*4;
offset+0: /* valid code */
...
offset+4; /* valid code */
...
offset+8; /* valid code */
...
/*etc*/
offset+80; /* who knows what might be here */
           /* BOOM! */

The compiler is free to use any method it wants for a 
switch{} construct, especially if there is no default case
at the bottom to catch problems like this.

Regards,

David Mathog
[EMAIL PROTECTED]
Manager, Sequence Analysis Facility, Biology Division, Caltech
_______________________________________________
gmx-users mailing list    gmx-users@gromacs.org
http://www.gromacs.org/mailman/listinfo/gmx-users
Please don't post (un)subscribe requests to the list. Use the 
www interface or send it to [EMAIL PROTECTED]
Can't post? Read http://www.gromacs.org/mailing_lists/users.php

Reply via email to