[lammps-users] lammps-users Digest, Vol 57, Issue 90

After I changed the position of “lmptype.h” in create_atoms.cpp, it’s solved.
Edit create_atoms.cpp and other cpp files which have the same problem,
move ‘#include “lmptype.h”’ in the top line, and re-compile it, all’s ok.

Cheers,
Cun Zhang

After I changed the position of "lmptype.h" in create_atoms.cpp, it's
solved.
Edit create_atoms.cpp and other cpp files which have the same problem,
move '#include "lmptype.h"' in the top line, and re-compile it, all's ok.

I'd like to understand why this works or even makes a difference, before
I change the various LAMMPS files.

The hope was that INT64_MAX, used now in lmptype.h would be
universally compatible with all compilers (defined in stdint.h).

So there are really 2 questions here:
a) do some compilers/machines still not work with this (C99 issue?)
b) why does changing the order of header files matter?

Axel, any insight?
Steve

After I changed the position of "lmptype.h" in create_atoms.cpp, it's
solved.
Edit create_atoms.cpp and other cpp files which have the same problem,
move '#include "lmptype.h"' in the top line, and re-compile it, all's ok.

I'd like to understand why this works or even makes a difference, before
I change the various LAMMPS files.

The hope was that INT64_MAX, used now in lmptype.h would be
universally compatible with all compilers (defined in stdint.h).

So there are really 2 questions here:
a) do some compilers/machines still not work with this (C99 issue?)
b) why does changing the order of header files matter?

Axel, any insight?

i've been wondering about that, too.

moreover, i cannot reproduce this behavior with the different
compilers that i have access to.

the only explanation that i can come up with would be that
it is related to the fact that in c++ you need to set extra
defines to get access to those c99 features and that some
preprocessors or c-library headers get confused.

the scenario that i could imagine would be that something
else pulls in the stdint.h or or inttypes.h headers but without
the __STDC_XXXX_MACROS defines and then doesn't pull
them in again when those macros are now set at a later point.

with lmptypes.h being such a low-level component and having
the side effects with the defines, it seems somewhat justified
to have that header pulled in first.

nevertheless, i would like to first understand where this is
coming from, i.e. what platform/compiler combos suffer from
this problem, since i don't see it on any platform (yet).

cheers,
    axel.