The following code snippet illustrates what I intended to do:
bool bPatterns[sizeof(short)*8];
void getMaskpattern(unsigned short mask)
{
unsigned short i;
for (i=0; i<sizeof(short) * 8; i++)
   bPatterns[i] = mask & (1 << i);
}
Took me a while to realise that the bool behavious is as if
#define bool char
And therefore the higher bits of mask is not "boolean copied" to
the
array. The compiler did not warn me about it for "type
conversions".
 
The fix is of course changing the assignment to
    bPatterns[i] = (mask & (1 << i)) != 0;
Question:-
What should be the correct behaviour for bool in the example above?
 
DMC++ version 8.28n