2010/4/7 Rico Schüller kgbricola@web.de:
- /* Check desc for NULL, this crashes on W7/DX10 */
- if (!desc)
- {
WARN("This should crash on W7/DX10!\n");
return E_FAIL;
- }
It's perfectly fine to require a parameter to be non-NULL, and just crash if it isn't. You'll get a nice backtrace, or at least an exception, which helps debugging as well.
- /* Check shader_index, this crashes on W7/DX10 */
- if (shader_index >= This->effect->used_shader_count)
- {
WARN("This should crash on W7/DX10!\n");
return E_FAIL;
- }
Similar as above. In general if Windows doesn't check something, we don't either. However, it's worth noting that if we'd be writing to that index we sometimes do check those, because there's the potential for memory corruption in those cases.