Next: 14.4 Avoid Unspecified GLUT Up: 14 Implementation Issues Previous: 14.2 Modular Implementation

## 14.3 Error Checking and Reporting

How errors and warnings about improper GLUT usage are reported to GLUT programs is implementation dependent. The recommended behavior in the case of an error is to output a message and exit. In the case of a warning, the recommended behavior is to output a message and continue. All improper uses of the GLUT interface do not need to be caught or reported. What conditions are caught or reported should be based on how expensive the condition is to check for. For example, an implementation may not check every `glutSetWindow` call to determine if the window identifier is valid.

The run-time overhead of error checking for a very common operation may outweight the benefit of clean error reporting. This trade-off is left for the implementor to make. The implementor should also consider the difficulty of diagnosing the improper usage without a message being output. For example, if a GLUT program attempts to create a menu while a menu is in use (improper usage!), this warrants a message because this improper usage may often be benign, allowing the bug to easily go unnoticed.

Next: 14.4 Avoid Unspecified GLUT Up: 14 Implementation Issues Previous: 14.2 Modular Implementation