#10 Compilation with ASSERTs off

closed-accepted
5
2009-02-27
2009-02-19
Anonymous
No

OS: Centos 5.2
GCC: g++ version 4.1.2
File: CBeacon.cpp
Line: 467

When asserts are disabled.

if (...)
ASSERT_(...)

expands to

if (...)

Which breaks the next line of code by thinking it is part of the if statement and compilation fails.

Perhaps the empty #defines in ./include/mrpt/utils/utils_defs.h should have braces. eg.

change

#else
# define ASSERT_(f)
# define MRPT_CHECK_NORMAL_NUMBER(val)
# define MRPT_COMPILE_TIME_ASSERT(f)
#endif

to

#else
# define ASSERT_(f) {}
# define MRPT_CHECK_NORMAL_NUMBER(val) {}
# define MRPT_COMPILE_TIME_ASSERT(f) {}
#endif

or just put braces around that one if statement. Your call :).

Regards,
Scott
elsm9 at lboro dot ac dot uk

Discussion

  • J.L. Blanco

    J.L. Blanco - 2009-02-27

    You're right!
    It's fixed for the next release by adding the braces at each #define, which I think is more secure.

    Thanks!

     
  • J.L. Blanco

    J.L. Blanco - 2009-02-27
    • assigned_to: nobody --> jlblanco
    • status: open --> closed-accepted
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks