[Dune] [Dune-devel] Reference and pointer type when dereferencing EntityPointer
Steffen Müthing
steffen.muething at iwr.uni-heidelberg.de
Mon Oct 20 10:38:54 CEST 2014
Hi Robert,
Am 20.10.2014 um 10:24 schrieb Robert Kloefkorn <robertk at posteo.de>:
> Hello Steffen,
>
>> OK, in that case I propose making those return types const. If nobody
>> cries foul until tomorrow, I’ll push the change.
>
> although your contributions to dune-grid are very welcome you should not
> do interfaces changes in the way you did last week.
>
yes, maybe I should have put up a vote. On the other hand, I asked about this on
the devel list and the only one who answered was Christian. And his answer was
basically „Oh, that was probably just a cock-up in the original design, we didn’t
know better / correctly think about this back then“.
> Even though the change was obvious it still seems to be open heart
> surgery, especially a non-const to const change calls for trouble.
> Like for any other interface change there must be a vote (doodle) and at
> least a proper notice time (and not something like I'll do it tomorrow).
As I said, the mere fact that the reference was returned this way was a complete surprise
to me - any DUNE code I’ve ever seen binds the return value of a dereferenced iterator or
EntityPointer to a const reference, so I naturally assumed that the returned type was const as
well. And I think at least some others developers thought the same (cf. the discussion on FS#1511).
>
> So for future changes to the core modules please be more responsible.
Yes, I’ll put up votes in the future. That said, is there a good reason to keep the non-const
reference? I don’t even think we really have a choice here because entities are now copyable.
Think about the following code:
Entity& e1 = *it1;
Entity& e2 = *it2;
e1 = e2;
What does that do to the internal state of it1?
Steffen
>
> Thanks,
>
> Robert
>
>
>
>
> _______________________________________________
> Dune mailing list
> Dune at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20141020/f06a3e59/attachment.sig>
More information about the Dune
mailing list