[petsc-dev] Could you look at this warning?

Barry Smith bsmith at mcs.anl.gov
Tue Mar 1 19:57:49 CST 2016


> On Mar 1, 2016, at 7:15 PM, Jed Brown <jed at jedbrown.org> wrote:
> 
> Barry Smith <bsmith at mcs.anl.gov> writes:
> 
>>  I've been ignoring this for a long time. We need to either
>> 
>> 1) fscanf into a local int that is 32 bit and then copy it into data but that will produce an incorrect value for very long integers passed in or
>> 
>> 2) have an ifdef that uses the correct %lld format when needed, maybe something like
> 
> Why not always read into a long long?
> 
>    else if (dtype == PETSC_INT)     if ((ret = fscanf(fd, "%lld", &tmp)) > 0) ((PetscInt*)data)[i] = tmp;

  It is not clear that Microsoft compilers support this :-(  but it would be a reasonable way to go (with a caste check of course).

  Barry







More information about the petsc-dev mailing list