Re: [eigen] Feature proposal - add error string to help debug const/non-const mapping errors

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


On Sun, Mar 3, 2013 at 7:06 AM, Christoph Hertzberg
<chtz@xxxxxxxxxxxxxxxxxxxxxxxx> wrote:
> On 03.03.2013 00:58, Rohit Garg wrote:
>>
>> Hi all,
>>
>> I have been using the Map objects a lot lately, and I have seen that
>> often, a simple mistake of mapping a const pointer as, say, MatrixXd.
>> Obviously, this leads to a big compiler error, which is often
>> difficult to decipher. I propose that a small error string be added to
>> Map object, which will aid debugging. Something similar to
>> "you_mixed_different_types_use_cast_function".
>>
>> This could prove very helpful. I know 3.2 beta is being planned, just
>> how big a change is this?
>
>
> I guess that's a rather small change (basically provide a const Scalar*
> constructor which has a static assertion).
> But I would vote against suggesting to "use_cast" in the error string.
> Maybe something like expecting_a_non_const_pointer or
> check_your_const_correctness, though this might be also a bit confusing to
> the novice (but it would be easier to provide a FAQ entry for that).

It's good to know that it's a small change. I mentioned the cast
string just to make a better reference to what I was talking about. I
should have phrased it better. Your suggestion for the error string is
a good one.


>
> Christoph
>
>
>
>
> --
> ----------------------------------------------
> Dipl.-Inf., Dipl.-Math. Christoph Hertzberg
> Cartesium 0.049
> Universität Bremen
> Enrique-Schmidt-Straße 5
> 28359 Bremen
>
> Tel: +49 (421) 218-64252
> ----------------------------------------------
>
>



-- 
Rohit Garg

http://rpg-314.blogspot.com/

Graduate Student
Applied and Engineering Physics
Cornell University



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/