[eigen] patches for EIGEN_STATIC_ASSERT

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


When used under MSVC on warning level 4, EIGEN_STATIC_ASSERT currently issues a "conditional expression is constant" warning every time it's used, and these can really add up.  I've attached two patches that both solve this problem in different ways:

StaticAssert_h_1.patch simply replaces the if statement inside the EIGEN_STATIC_ASSERT macro with a scope-block, and is the simpler of the two fixes.

StaticAssert_h_2.patch is a more fundamental change to EIGEN_STATIC_ASSERT.  It's advantage is that you don't have to update the enum containing the error messages each time you add a new message.  You can simply pass in any textual message that is a valid C++ identifier (all of the existing ones are).  The disadvantage to this method over the current implementation is that the compiler output is slightly less "pretty", but it's still obvious that a compile-time assert has failed and the error message should be prominently displayed by any good compiler.

-Kenny Riddile


--- On Wed, 12/17/08, Benoit Jacob <jacob.benoit.1@xxxxxxxxx> wrote:

> From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
> Subject: Re: [eigen] New Eigen users forum!
> To: eigen@xxxxxxxxxxxxxxxxxxx
> Date: Wednesday, December 17, 2008, 4:06 PM
> And that being said, as long as it keeps reasonable (like it
> is
> currently), I don't mind a certain amount of user
> questions on the
> mailing list. So if you prefer asking questions on the
> list, by me
> it's ok.
> 
> Cheers,
> Benoit
> 
> 2008/12/17 Keir Mierle <mierle@xxxxxxxxx>:
> > Is having a separate forum really a good idea? It
> seems the eigen community
> > is pretty small. Wouldn't it be better to
> encourage traffic on this list
> > instead of balkanizing discussion?
> >
> > Keir
> >
> > On Wed, Dec 17, 2008 at 12:52 PM, Benoit Jacob
> <jacob.benoit.1@xxxxxxxxx>
> > wrote:
> >>
> >> Hi List,
> >>
> >> We just opened a users forum here:
> >> http://forum.kde.org/eigen-f-74.html
> >>
> >> I'm trying to get people to use it for getting
> support with using
> >> Eigen. Ideally we'd have a community of users
> able to help each
> >> other... Until that's the case at least I am
> reading the forum and
> >> will  answer questions;  that's far less
> time-consuming for me than
> >> IRC (i'm easily distracted away from work).
> >>
> >> Of course IRC and this mailing list continue as
> usual! The mailing
> >> list is perfect for discussing eigen development,
> asking a licensing
> >> question, reporting a bug, submitting a patch; IRC
> is great for a
> >> friendly chat or a very interactive technical
> discussion, but we can't
> >> always be online.
> >>
> >> Cheers,
> >> Benoit
> >>
> >> ---
> >>
> >
> >
> 
> ---

Attachment: StaticAssert_h_1.patch
Description: Binary data

Attachment: StaticAssert_h_2.patch
Description: Binary data



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