Is the scancode example incorrect or am I just confused?

I’m trying to understand scancodes and how they differ from keycodes, and I thought I did but the example at https://wiki.libsdl.org/SDL_Scancode#code_examples made me unsure.

if (event->key.keysym.scancode != SDL_GetScancodeFromKey(event->key.keysym.sym)) {

If SDL_GetScancodeFromKey always just looked up the keycode in the table that is shown above the example and returned the scancode on the same row (e.g. SDLK_a → SDL_SCANCODE_A, SDLK_b → SDL_SCANCODE_B, etc.) then I can understand but according to the SDL_GetScancodeFromKey page it’s based on the current keyboard layout so it seems to me like this condition would always be false because SDL has already done this mapping when creating the key event.

Is the example wrong, or is the SDL_GetScancodeFromKey page wrong, or am I wrong? I only have a QWERTY keyboard so I haven’t been able to test when the mapping is different.

I think you’re right and the example is wrong (or at least misleading).

Though I’m not 100% what it means with “remapping”, is a non-US-QWERTY layout “remapped”?
Or is this about people remapping e.g. Capslock to Ctrl? And if it is, would SDL_GetScancodeFromKey() really not know about it? (Ok, maybe in that case SDL_GetScancodeFromKey() for Ctrl would return the Ctrl scancode instead of the Capslock scancode, as it can’t return both - unless maybe the real Ctrl key is mapped to something else so it’s a again one-to-one correspondence between used scancodes and keycodes)

Either way, I don’t think it’s a good example to illustrate what a scancode is supposed to be.