<div class="gmail_quote">On Wed, Jun 1, 2011 at 04:56, Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com">knepley@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I did not want to downcast because PetscPow() works for (Scalar, Int) and (Scalar, Real) so automatically casting to (int) is not right.</blockquote></div><div><br></div>1. There is no PetscPow() :-)<div><br><div>2. In C, PetscPowScalar *always* has arguments (PetscScalar, PetscScalar), *not* (PetscScalar,PetscReal), (PetscScalar, int), or other variants. The fact that it "works" with other combinations is only because of C's automatic promotion rules. C++ has different promotion rules and overloads the name for (PetscScalar, int).</div>
<div><br></div><div>This still isn't (PetscScalar, PetscInt). Indeed, if PetscInt is int64_t, then PetscPowScalar(some_scalar, some_int) fails. That is the problem you fixed by introducing PowInt. But PowInt is always defined to be int, either by explicit typedef (with PETC_USE_64BIT_INDICES) or indirectly (because PetscInt was already typedef'd to int). So "typedef int PowInt" will always be equivalent to what you have.</div>
</div>