3 ms·
This is a solved problem: https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-rgb https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf.
by userbinator 5y ago
This is a solved problem:
https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-rgb https://docs.microsoft.com/en-us/windows/win32/api/wingdi/nf...
(If you still manage to get the ordering wrong even when you're forced to write the name of this macro... then programming is probably not for you.)
Edit: I just noticed the return type is "void". This error is entirely due to the destruction of MSDN; my copy of WIN32.HLP has the correct definition.
- isatty 5y agoI have no idea how this is supposed to prevent human error by reading that page.
- jraph 5y ago> If you still manage to get the ordering wrong even when you're forced to write the name of this macro... then programming is probably not for you Humility is key to prevent disasters, and ordering will be gotten wrong as long as there is no type checking and we are relying on people to double check the ordering. A mistake can happen because of a temporary lack of attention, tiredness, confusion, distraction, interruption… I hope any experienced programmer is aware of this, or maybe they should avoid programming?
- andai 5y agoI do have to wonder if RGB(R(1), G(2), B(3)) is really going to be helpful at the level of sleep deprivation where someone would get RGB(1,2,3) wrong.
- jraph 5y agoI don't think it solves the problem, because you can still swap 1 and 2. Ideally, 1 and 2 are of different types (which may not always be practical). It could make it easier to spot an error if 1 and 2 are in fact variables that have a name (RGB(R(green), G(red), B(blue))) screems HEY SOMEHTING IS WRONG THERE).
- userbinator 5y agoPonder this point deeply: "Freedom includes the freedom to make mistakes."