[petsc-dev] clang warning, 64bit indices

Satish Balay balay at mcs.anl.gov
Wed Mar 9 14:17:10 CST 2016


On Wed, 9 Mar 2016, Lisandro Dalcin wrote:

> On 9 March 2016 at 23:00, Satish Balay <balay at mcs.anl.gov> wrote:
> > On Wed, 9 Mar 2016, Lisandro Dalcin wrote:
> >
> >> On 9 March 2016 at 22:51, Satish Balay <balay at mcs.anl.gov> wrote:
> >> > Well the following works..
> >>
> >> OK, but that's a small int, and you are little-endian, right? Could
> >> you try the following?
> >>
> >> char c[] = "9223372036854775807"
> >
> > sbalay at ps3 ~/junk
> > $ ./te.exe
> > 9223372036854775807
> >
> 
> Great! What would be the right #define guard for Windows builds?

#if defined(PETSC_HAVE_STDINT_H)
  scanf(format for  int64_t);
#elif (PETSC_SIZEOF_LONG_LONG == 8)
  scanf(format for long long);
#elif defined(PETSC_HAVE___INT64)
   scanf(format for __int64 - aka windows);
#endif

Satish



More information about the petsc-dev mailing list