c++ - How are state flags represented and how bitwise OR is used to work with bit flags? -
if open file reading, may define 1 or more state flags, example: ios::out ios::out | iso::app i read bitwise or, , how "merges" 2 bit sets, for example: 1010 | 0111 = 1111 now being said, not understand how works "behind scenes" when use method ifstream.open(filename, stateflaga | stateflagb | stateflagc) , on. can elaborate more on inner workings of these state flags , memory representation? edit: give more emphasis on trying understand (if helps), assume open method receive 1 or more state flags separate arguments in signature, , not delimited bitwise or, want understand how bitwise or works on these state flags produce different final state when combining several flags, , result allows me use 1 argument state flag or set of state flags. ie: ifstream.open(filename, stateflaga | stateflagb | stateflagc) and not ifstream.open(filename, stateflaga , stateflagb , stateflagc) if take gnu libstdc++ implementation , @ how these implemented,