[gmx-developers] 64bit integers

Roland Schulz roland at utk.edu
Fri Jul 10 18:42:54 CEST 2009


Hi,

which integer type should be used for integers that should be 64bit if
available.

My current problem: ndim*ndim*4 in gmx_covar overflows for more than 7723
atoms.

One could use:
- long (is only 32bit on windows)
- long long (is always 64bit, not defined in C89)
- size_t (is the size of pointer)
- same typedef

- One shouldn't use long, since it wouldn't solve it on windows.
- Using "long long" is slow (in this case unimportant) and will give warning
when passed to snew or memcpy.
- size_t doesn't seem very clean and will give warnings when passed to
printf (unless first upcasting to "unsigned long long" and then using %llu).


Is C89 support required?
Is it OK to use size_t for those integers?

What is the best option?

BTW: Is it OK to change save_calloc and save_realloc to size_t (currently
"unsigned")?

Roland

-- 
ORNL/UT Center for Molecular Biophysics cmb.ornl.gov
865-241-1537, ORNL PO BOX 2008 MS6309
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://maillist.sys.kth.se/pipermail/gromacs.org_gmx-developers/attachments/20090710/9114b8eb/attachment.html>


More information about the gromacs.org_gmx-developers mailing list