dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #10369
Re: [HG DOLFIN] Use const_cast to get UFCCell to compile.
On Sat, Oct 25, 2008 at 11:17:15PM +0200, DOLFIN wrote:
> One or more new changesets pushed to the primary dolfin repository.
> A short summary of the last three changesets is included below.
>
> changeset: 4993:01188514d401addaa869e7c99acc87dce6889f3b
> tag: tip
> user: "Garth N. Wells <gnw20@xxxxxxxxx>"
> date: Sat Oct 25 22:17:05 2008 +0100
> files: dolfin/fem/UFCCell.h
> description:
> Use const_cast to get UFCCell to compile.
>
> Should ufc::cell::entity_indices and ufc::cell::coordinates be
>
> unsigned int const** and
>
> double const**
>
> ?
Yes, it looks like we've made a mistake in UFC.h. I found the
following uses of "const" and "*" in UFC.h:
1. const double* coordinates
This should really be
double* const coordinates
This means that the function promises not to change the values in the
coordinates array, which is what we want. The way we do it now is that
we promise not to change the pointer, which has no meaning since the
pointer is passed by value and changing that copied pointer inside the
function does not modify the pointer passed to the function.
2. const double* dof_values
Same here.
3. const double * const * w
This should really be
double * const * const w
meaning that we don't change the arrays pointed to and not the values
in those arrays.
4. const char* signature() const = 0;
Why don't we use std::string here?
Can we change this in UFC? It's needed for const-correctness in DOLFIN
(and other codes that may use UFC).
Martin?
--
Anders
Attachment:
signature.asc
Description: Digital signature
Follow ups
References