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

前端 未结 6 866
花落未央
花落未央 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:45

    Promoting my comment to an answer:

    You can use a macro to redefine them to something that won't compile:

    #define GetProfile  HAHA_Nice_try_This_will_not_compile!!!
    

    The catch is that you need to make sure that it isn't (legitimately) called outside your code.
    (So you should put the macro after all your includes.)

提交回复
热议问题