Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22130

Why does program miss 'if' operator? [closed]

$
0
0

The problem is the wrong executing of the program because of it misses condition statements in some function apparently.

Here is some example:

void f(uint32_t eventsFlags) // eventFlags == 0x1
{
    // statement 1
    ...
    // statement N

    if (SOME_VAL_1 | eventsFlags) // SOME_VAL_1 == 0x1 (true)
    {
        // statement N+1
        ...
        // statement M
    }

    if (SOME_VAL_2 | eventsFlags) // SOME_VAL_2 == 0x40 (false)
    {
        // statement M+1
        ...
        // statement K
    }
}

When I debug it, 'statement N+1' comes right after 'statement N' missing the condition check between them. The same thing happens to 'statement M' and 'statement M+1' and the condition check between them. That is the reason of statements from M+1 to K are executed but they must not.

Edited: Excurse me as I have not noticed there is | instead & beacuse it really had been & until I inattentively had changed the code sometime.


Viewing all articles
Browse latest Browse all 22130

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>