0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

引数の追加に強い呼び出し規約cdecl

Last updated at Posted at 2019-04-19

今日、初めて気づいたのですが、
cdelcの関数の場合、
引数を過剰に与えて呼び出してもOKなんですね。

cdeclとは?

  1. 呼び出し側で引数をスタックに右から積む
  2. call
  3. 呼び出し側でスタックをポップする

右から積んでいるので、呼び出された側は、右側に引数が追加されても気づきません。

DLLのインターフェースを変更したときに、あれ?なんでこれ呼び出される側を書き換えていないのに動くんだろう?と気づきました。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?