SDL_GetKeyState

Hi

Uint8 *keys;
keys = SDL_GetKeyState(NULL);

Why is it wrong of me to delete keys afterwards?

Thanks

and should not be freed by the caller."

In other words, it’s not yours to delete – you have a pointer to it, but
it’s also being used elsewhere.On Sat, Jun 08, 2002 at 12:44:10AM +0200, Thomas Stian Bergheim wrote:

Uint8 *keys;
keys = SDL_GetKeyState(NULL);
Why is it wrong of me to delete keys afterwards?

From the docs: "The pointer returned is a pointer to an internal SDL array

Matthew Miller @Matthew_Miller http://www.mattdm.org/
Boston University Linux ------> http://linux.bu.edu/

Matthew Miller wrote:>On Sat, Jun 08, 2002 at 12:44:10AM +0200, Thomas Stian Bergheim wrote:

Uint8 *keys;
keys = SDL_GetKeyState(NULL);
Why is it wrong of me to delete keys afterwards?

From the docs: “The pointer returned is a pointer to an internal SDL array
and should not be freed by the caller.”

In other words, it’s not yours to delete – you have a pointer to it, but
it’s also being used elsewhere.

Does this mean that I can get a pointer to it once and then use it when
I need to (i.e. it never changes)??

RK.