Bug #887
add do while to nldebug and co
| Status: | Closed | Start date: | 05/12/2010 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | % Done: | 100%  | 
||
| Category: | - | |||
| Target version: | Version 0.8.0 | 
Description
like this
#define nlassert(exp) \
do { \
    if (!(exp)) { \
        NLMISC::createDebug (); \
        NLMISC::INelContext::getInstance().getAssertLog()->setPosition (LINE, FILE, FUNCTION); \
        NLMISC::INelContext::getInstance().getAssertLog()->displayNL ("\"%s\" ", #exp); \
        NLMISC_BREAKPOINT; \
    } \
} while(0)
This should hopefully fix some warnings. 
May break some code that doesn't have ";" after nldebug
History
#1
    
    
    Updated by rti over 8 years ago
    
    Why not just add a ";" behind while(0)?
This way you would not break any code.
Just tried it; gcc does not complain about ";;" situations, even with "-Wall -pedantic"
#2
    
    
    Updated by Letto over 8 years ago
    
    Well some would say that this would be a feature not a bug.
#3
    
    
    Updated by vl over 8 years ago
    
    which warning will be fixed with the do/while?
I prefer to not have the ; in the define so guys have to add a ; after the call.
#4
    
    
    Updated by Letto over 8 years ago
    
    which warning will be fixed with the do/while?
ambiguity about nested ifs
#5
    
    
    Updated by vl over 8 years ago
    
    - Status changed from New to Assigned
 - Assignee set to vl
 
#6
    
    
    Updated by vl over 8 years ago
    
    - Status changed from Assigned to Resolved
 - % Done changed from 0 to 100
 
Applied in changeset r133.
#7
    
    
    Updated by vl over 8 years ago
    
    Applied in changeset r139.
#8
    
    
    Updated by vl over 8 years ago
    
    - Target version set to Version 0.8.0
 
#9
    
    
    Updated by vl about 8 years ago
    
    - Status changed from Resolved to Closed