We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1882

Summary: SDL_GetKeyboardState should return const.
Product: SDL Reporter: Yuri K. Schlesner <yuriks>
Component: eventsAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 2.0   
Hardware: x86   
OS: Windows 8   

Description Yuri K. Schlesner 2013-05-31 22:16:20 UTC
The array returned by SDL_GetKeyboardState is also used internally by SDL to keep track of pressed/released keys and must not be modified, lest weird behaviour occurs. Because of this I believe it's return type should be changed to return a const pointer, which will provide a code indication of that fact. This can cause existing code to stop compiling, so before a stable release of SDL 2 is the ideal moment to do a change like this.

Failing that, the wiki docs should at least mention this.
Comment 1 Sam Lantinga 2013-06-02 04:09:51 UTC
Agreed.  Good catch!
http://hg.libsdl.org/SDL/rev/89d47188c9a4