c language function the same name issue

Copyright Notice: Copyright, reproduced shall indicate the source. https://blog.csdn.net/Brouce__Lee/article/details/91814233

Problem: Linux program under the dynamic link library c always fail, prompting several functions in the library there is a problem. Suffer find no avail, and finally found the cause - library c two functions the same name.

Conclusion: The best not to the same name, but you can avoid this problem by some restrictions.


Question: c language can function overloading it?

answer: can be achieved. I made reference to several theories.

1, c language does not support function overloading. Have the same active area may not function the same name but different region of action allows functions the same name. Different active region may be achieved by using a static in different files.

2, to achieve the C function overloading it, the more common practice is to use C variable parameters va_args.

Contrast: reflects the characteristics of the package c ++, c ++ function overloading can be achieved, is called by the application need to specify the function namespace. In fact, the translation of the name of the overloaded function has been modified, recall it as a modified form of the function name and parameters.


Reference 1

Reference 2 - c language function in the same name

How to implement function overloading reference 3-- C,

Guess you like

Origin blog.csdn.net/Brouce__Lee/article/details/91814233