Click to See Complete Forum and Search --> : Passing a default value for COLORREF?
Edwin Knoppert
August 8th, 2007, 02:50 PM
I ogten use(d) -1 to pass an invalid color, in g++ i get a warning (of course) and i was looking for a better solution like:
void test( COLORREF c )
{
if( c == NULL )
{
MessageBox( 0, "NULL", "", 0 );
} :ehh:
}
However.. value 0 is also NULL..
TheCPUWizard
August 8th, 2007, 03:01 PM
There really are no "default" values possible, since all possible bit patterns represent a legitimate color. However some colors are very unlikely to appear (especially when you take into account the AphaChannel. For example 0x80fe01fe...Willing to bet that does not show up in the "wild", but remember there are no guarantees....
Edwin Knoppert
August 8th, 2007, 03:43 PM
But -1 is a an rgb of FF FF FF and alpha of FF
But ok, it's still incorrect, do not know what to do with the same param.
Maybe function overloading is the only solution.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.