Can I force a compiler error if certain functions are called?

前端 未结 6 867
花落未央
花落未央 2021-01-11 13:19

I have v1 and v2 versions of my software. v1 uses the registry to save settings, with lots of calls to GetProfileInt, etc. v2 now uses an sqlite db to save settings.

<
6条回答
  •  花落未央
    2021-01-11 13:55

    I believe you could #define GetProfileInt(a, b, c) "don't use this"; after #include'ing Windows.h.

    Since GetProfileInt is a macro for routing to the proper function, this would result in a macro redefinition. And since char[] can't be assigned to UINT, the compiler error's.

    It's a dirty, dirty hack though, I feel like taking a shower for discussing it.

提交回复
热议问题