Incrementing function pointers

后端 未结 5 1319
隐瞒了意图╮
隐瞒了意图╮ 2021-01-17 15:36

I just learned about function pointers (pointers pointing at the adress where where the machine code of a function is stored). This made me think about machine code and how

5条回答
  •  春和景丽
    2021-01-17 15:55

    You can (or at least could) do something like this, but it's decidedly non-trivial. First of all, you can't actually increment or decrement a function pointer -- it points to an address, but pointer math is normally done in increments of sizeof(pointed to type) -- but with a function, that isn't meaningful, so you can't do math on it.

    Most debuggers work (primarily) by using debugging information that relates address to line numbers, function names, variable names, etc.

提交回复
热议问题