[gmx-developers] Coordinate scaling in pdbio.c

Szilárd Páll szilard.pall at cbr.su.se
Wed Apr 11 22:20:36 CEST 2012


It's worth noting that in C "const" variables are not *compile-time*
constants which limits their use (e.g. case labels or array sizes)! In
contrast, in C++ here is no such limitation.

When it comes to C there are three ways to define constants:
- macros (#define)
- (anonymous) enums
- const variables

Each of them has advantages and disadvantages, but what's worth noting
is that enum constants are often the best replacement for #define-s,
especially for integral types.

In the case of the original example (as noted in the diverged thread)
"const" constants are in fact a good option.

--
Szilárd



On Wed, Apr 11, 2012 at 9:30 PM, Erik Marklund <erikm at xray.bmc.uu.se> wrote:
>
> 11 apr 2012 kl. 15.58 skrev Mark Abraham:
>
> Also, such macro "symbols" are normally not available when debugging, and
> that can make life hard.
>
>
> How true.
>
> -----------------------------------------------
> Erik Marklund, PhD
> Dept. of Cell and Molecular Biology, Uppsala University.
> Husargatan 3, Box 596,    75124 Uppsala, Sweden
> phone:    +46 18 471 6688        fax: +46 18 511 755
> erikm at xray.bmc.uu.se
> http://www2.icm.uu.se/molbio/elflab/index.html
>
>
> --
> gmx-developers mailing list
> gmx-developers at gromacs.org
> http://lists.gromacs.org/mailman/listinfo/gmx-developers
> Please don't post (un)subscribe requests to the list. Use the
> www interface or send it to gmx-developers-request at gromacs.org.



More information about the gromacs.org_gmx-developers mailing list