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
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Feature proposal - add error string to help debug const/non-const mapping errors
- From: Rohit Garg <rpg.314@xxxxxxxxx>
- Date: Sun, 3 Mar 2013 23:54:36 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:content-type:content-transfer-encoding; bh=P9Nh5gJNrzQQ7pkNHg9sQ3L3HwYmplYMtWl0DLagFBU=; b=z7OLiGmFySNX2d8pDIpOYJiXQgLQ2+QBTk8ypEWhNEDjlSZam71eISp0ttFp+ARLFX wldvZE3iKkB2q4gxx4K0G6WYTiJkRs42BMRQ3fnawTjCyEZrZyrDwLjQkDwOQL/KtHrl urGFmfSAcct2r55mknuhiJMPzAgiCvPfFQjpD27pqx+YGqN54nsg3iY3DjJGQp57Zbtg DtFehFOC1AEoYKpFxEEVIat8qCuLZLBuF1OO88mZ2Q8mtwnDSp9Ki5jhxsTd++QTU18z qejLN9fZkZo/gIxJsAaxYh0uYiVfOwJ0t7bhtXMFU85hHwSAkMZtBAh7dCsPnsOqS5VC 9HSg==
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