Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compare real kinds directly #80

Merged
merged 1 commit into from
Aug 3, 2017
Merged

Conversation

certik
Copy link
Contributor

@certik certik commented Aug 3, 2017

In order to determine if the real kinds are equal, one can just compare them
directly, they are just integers. This is simpler, and also allows these lines
to be compiled with NAG. For some reason NAG does not seem to have c_sizeof()
as part of the iso_c_binding module and so it fails on these lines. This
commit fixes it.

In order to determine if the real kinds are equal, one can just compare them
directly, they are just integers. This is simpler, and also allows these lines
to be compiled with NAG. For some reason NAG does not seem to have `c_sizeof()`
as part of the `iso_c_binding` module and so it fails on these lines. This
commit fixes it.
certik referenced this pull request in certik/amrex Aug 3, 2017
@nncarlson
Copy link
Contributor

The original code using c_size() is simply wrong (not just more complicated). amrex_real is an integer variable (or parameter), and c_size(amrex_real) is the C size of a Fortran integer, not the size of a real(kind=amrex_real) variable which was intended. The pull request code does exactly the right thing.

If there is any similar use of c_size() in the code, it's wrong and needs to be fixed.

@WeiqunZhang
Copy link
Member

You are absolutely right.

@WeiqunZhang
Copy link
Member

Fortunately, that's the only place c_sizeof is used.

@WeiqunZhang WeiqunZhang merged commit 7e8d023 into AMReX-Codes:master Aug 3, 2017
@certik certik mentioned this pull request Aug 3, 2017
3 tasks
@certik certik deleted the size_of_fix branch August 3, 2017 20:32
@certik
Copy link
Contributor Author

certik commented Aug 3, 2017

Thanks for merging @WeiqunZhang!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants