[Insight-developers] assert and explicit instantiations
Gaëtan Lehmann
gaetan.lehmann at jouy.inra.fr
Sun Jun 14 15:34:04 EDT 2009
Le 14 juin 09 à 18:43, Luis Ibanez a écrit :
>
>
> Hi Gaetan,
>
Hi Luis,
> You should probably use the new Macro:
>
> itkAssertOrThrowMacro
>
>
> That is defined in
>
> Insight/Code/Common/itkMacro.h
>
>
> It will use Asserts when compiled in Debug mode,
> and it will throw Exceptions when compiled in
> Release mode.
Well, we should carefully use that macro, because exceptions can have
serious impact on performance.
In that case, the assert() is in operator++() and Set() methods of an
iterator.
http://public.kitware.com/cgi-bin/viewcvs.cgi/Code/Common/itkTreeIteratorBase.h?root=Insight&r1=1.12&r2=1.13&sortby=date
http://public.kitware.com/cgi-bin/viewcvs.cgi/Code/Common/itkTreeIteratorBase.txx?root=Insight&r1=1.14&r2=1.15&sortby=date
This is the kind of case where I wouldn't replace an assert() by
itkAssertOrThrowMacro(), or at least without carefully measuring the
execution times.
Regards,
Gaëtan
>
>
>
> Luis
>
>
> -----------------------
> Gaëtan Lehmann wrote:
>> Hi Julien,
>> I have commented an assert() in
>> Code/Common/itkTreeIteratorBase.h
>> Code/Common/itkTreeIteratorBase.h
>> to fix build with explicit instantiation.
>> The compiler was giving that error:
>> /export/home/glehmann/src/Insight/Code/Common/
>> itkTreeIteratorBase.h: 182: erreur: ‘assert’ was not declared in
>> this scope
>> Is it the expected behavior?
>> Thans,
>> Gaëtan
>> ------------------------------------------------------------------------
>> _______________________________________________
>> Powered by www.kitware.com
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>> Please keep messages on-topic and check the ITK FAQ at: http://www.itk.org/Wiki/ITK_FAQ
>> Follow this link to subscribe/unsubscribe:
>> http://www.itk.org/mailman/listinfo/insight-developers
--
Gaëtan Lehmann
Biologie du Développement et de la Reproduction
INRA de Jouy-en-Josas (France)
tel: +33 1 34 65 29 66 fax: 01 34 65 29 09
http://voxel.jouy.inra.fr http://www.itk.org
http://www.mandriva.org http://www.bepo.fr
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 203 bytes
Desc: Ceci est une signature ?lectronique PGP
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20090614/108a0034/attachment.pgp>
More information about the Insight-developers
mailing list