| Summary: | SDL_Error() should unconditionally return -1? | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Ryan C. Gordon <icculus> |
| Component: | *don't know* | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | minor | ||
| Priority: | P2 | ||
| Version: | HG 2.0 | ||
| Hardware: | All | ||
| OS: | All | ||
Tossing this to Sam to consider. --ryan. I like it! Fixed in hg changeset 3fedf1f25b94 and 7f22b9ba218f. This drops 699 lines from the source tree. :) --ryan. Woo! :) |
This might be a stupid idea, but I'll throw it out there. SDL_Error() should return an int, and always return -1. It makes this code... if (malloc(16) == NULL) { SDL_OutOfMemory(); // this is a macro of SDL_Error(). return -1; // what most SDL entry points return for errors. } ...into the more-compact form: if (malloc(16) == NULL) return SDL_OutOfMemory(); We can change this without breaking the 2.0 ABI, as any existing code expects this to return void and thus won't care if it suddenly returns a value. --ryan.