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 - SDL_GetKeyboardState should return const.
Summary: SDL_GetKeyboardState should return const.
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: events (show other bugs)
Version: HG 2.0
Hardware: x86 Windows 8
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-31 22:16 UTC by Yuri K. Schlesner
Modified: 2013-06-02 04:09 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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