How do you create a debug only function that takes a variable argument list? Like printf()

后端 未结 14 2183
心在旅途
心在旅途 2020-12-23 09:44

I\'d like to make a debug logging function with the same parameters as printf. But one that can be removed by the pre-processor during optimized builds.

<
14条回答
  •  情深已故
    2020-12-23 10:17

    What platforms are they not available on? stdarg is part of the standard library:

    http://www.opengroup.org/onlinepubs/009695399/basedefs/stdarg.h.html

    Any platform not providing it is not a standard C implementation (or very, very old). For those, you will have to use varargs:

    http://opengroup.org/onlinepubs/007908775/xsh/varargs.h.html

提交回复
热议问题