2

I have two functions with following signatures:

Memory memInitDebug (Size size, Size base);

and

Memory memInitRelease (Size size);

(Size is a typedef for size_t)

In implementation, memInitRelease simply calls memInitDebug with the value of base as 0.

Is there any way to use _Generic to emulate default value of arguments so that I can have a single function/macro memInit that selects the appropriate function based on the number of arguments?

(Currently, I am using Clang's overloadable attribute to achieve this but I'd rather not use compiler extensions).

strNOcat
  • 913
  • 2
  • 8
  • 22
  • 1
    Unrelated to your problem, but please try to avoid making up your own type-aliases for standard types (like `size_t`). No one else but you will know about such aliases unless explicitly told about it, and if you forget then reading the code will make no sense. – Some programmer dude Dec 20 '17 at 06:58

0 Answers0