Re: [eigen] Index bounds checking assertion

[ Thread Index | Date Index | More Archives ]

I don't know... by entering a debugger, the user can print row and col
and rows() and cols() and figure it out right away; no need for printf
debugging here.

Splitting this into more assertions will have the (small) drawback of
inflating a bit more the code size, since each assertion will have its
own string, and these are rather long strings. Suppose each string is
150 bytes, this would go from 1 to 4 strings, so 450 more bytes. The
problem is that this is for each separate expression type, and a
typical can have many of those, e.g. 100 types, leading to a 45 kB
code size increase. Of course this goes away when you disable asserts,
but currently leaving asserts often has a negligible speed cost, which
allows many users to leave them in even in release code.


2010/6/9 Rohit Garg <rpg.314@xxxxxxxxx>:
> Presently, in the DenseCoeffsBase.h, file, line 305, we have the
> runtime assertion, row >= 0 && row < rows() && col >= 0 && col <
> cols()
> It will be better to split it into 4 assertions so that when the
> assertion fails, we get a more pointed message. Otherwise, the user
> needs  to do some debugging, (printf or otherwise), just to figure out
> which index malfunctioned and from what side.
> --
> Rohit Garg
> Senior Undergraduate
> Department of Physics
> Indian Institute of Technology
> Bombay

Mail converted by MHonArc 2.6.19+