error checking macros with optimization

Barry Smith bsmith at
Fri Nov 23 09:59:28 CST 2007


      There are actually two separate concerns: optimized builds and  
error checking.
--with-errorchecking and --with-debugging I would like to keep them  

Currently --with-errorchecking has an on or off value and --with- 
debugging has an on or off value

If you are proposing an intermediate --with-errorchecking that simply  
returns the
error codes that is fine with me.


I still want by default --with-debugging=0 to leave on the full error  
checking. Reason:
most programmers are morons and develop code with optimization on  
(why? because
they are dumb as stones and no matter how many times you tell them it  
is a bad idea
they just ignore it, they prefer to spend hundreds of hours tracking  
down bugs without
debug symbols then waste 1/1000 of a second on slower code while  


On Nov 23, 2007, at 9:25 AM, Lisandro Dalcin wrote:

> I would to propose some changes to error checking macros for  
> optimized builds.
> 1.- SETERRQXXX: define them as
> #define SETERRQ[1|2|..](ierr,...)   return ierr
> 2.- CHKERRQ: define them as
> #define CHKERRQ(ierr)  if (ierr) return ierr
> For (1), it should be no performace impact. For (2), the extra check
> at almost every line of PETSc source code could impact performace, but
> any of you have a clear idea of how much?
> -- 
> Lisandro Dalcín
> ---------------
> Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
> Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
> Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
> PTLC - Güemes 3450, (3000) Santa Fe, Argentina
> Tel/Fax: +54-(0)342-451.1594

More information about the petsc-dev mailing list