difference between a flag and a parameter

Please answer the topic, n into detaiils if you can............zzzzzzzz........
closed account (zb0S216C)
In the typical fashion, a "flag" is represented as a bit-mask. Flags are generally used to indicate either states (mutex lock state, invalid state, etcetera), or parameters (use alpha channel, disable anti-aliasing, etcetera). Here's an example of each:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
enum Flags 
{
    STATE_MUTEX_LOCKED = (1 << 0), // State flag.
    PARAM_NO_AA = (1 << 1)         // Parameter flag.
};

void function(Flags flags) // "flags" is a formal parameter.
{
    if(flags & PARAM_NO_AA)
    {
        if(flags & STATE_MUTEX_LOCKED)
            // ...
    }
}

A "parameter" can either be a flag (as above), or it can be a formal parameter (function parameter).

Wazzak
Thanks!
Topic archived. No new replies allowed.