Is it ok to define static inline function with same name in different files?

Sato

For example, a.h

static inline void asdf(int a) {}

b.h

static inline void asdf(int a) {}

is this ok? will there be any conflicts?

Serge Ballesta

It will only be ok if no single source ever include both headers. If all .c files either include only a.h or only b.h or none, then all will be fine.

If both header were included in same source, you would get an error for redefinition of asdf.

An acceptable example would be if none of the .c files include directly a.h or b.h but only a c.h file containing:

#ifdef A_TYPE
#include a.h
#else
#include b.h
#endif

because the choice of the implementation would rely on a compile time constant

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Unable to create a function with the same name as a static function

From Dev

Same function name in different namespaces

From Dev

Same function name in different namespaces

From Dev

How to collect Django static files with the same name?

From Dev

Django and/or Apache: serve (static) files with a different name

From Dev

Static member function, same name, different code, only the first encountered version is used, why is that?

From Dev

Can we use same function name in 2 different file in C by giving static?

From Dev

Is it ok to compile files with different gcc optimization levels for same application?

From Dev

Is inline equals #define function?

From Dev

How to detect files with the same name but different extensions?

From Dev

Renaming Files With Same Name, Different Extension in Linux:

From Dev

How to detect files with the same name but different extensions?

From Dev

Find files with same name but different content?

From Dev

Finding and copying files with same name but different extensions

From Dev

zip multiple files with the same name but different extensions

From Dev

Delete files same name but different file extension

From Dev

Merge files with same name in different folders

From Dev

Find files with same name in different folders

From Dev

Different static files for the same path but different domains on App Engine

From Dev

Are different translation units allowed to define structures with the same name?

From Dev

Is it legal to define two methods with the same name but different returning types?

From Dev

Is it ok to declare/define a static method in the .cpp only?

From Dev

How to implement different working on same function through inline JavaScript

From Dev

Initializing static member function pointer to function of same name

From Dev

2 files having the same name but different paths => vim thinks they are the same

From Dev

Combining files with same name in r and writing them into different files in R

From Dev

Combining files with same name in r and writing them into different files in R

From Dev

Why define a function prototype, then preprocessor macro with the same name?

From Dev

Javascript closure (using parameter name to define an object in the same function)

Related Related

  1. 1

    Unable to create a function with the same name as a static function

  2. 2

    Same function name in different namespaces

  3. 3

    Same function name in different namespaces

  4. 4

    How to collect Django static files with the same name?

  5. 5

    Django and/or Apache: serve (static) files with a different name

  6. 6

    Static member function, same name, different code, only the first encountered version is used, why is that?

  7. 7

    Can we use same function name in 2 different file in C by giving static?

  8. 8

    Is it ok to compile files with different gcc optimization levels for same application?

  9. 9

    Is inline equals #define function?

  10. 10

    How to detect files with the same name but different extensions?

  11. 11

    Renaming Files With Same Name, Different Extension in Linux:

  12. 12

    How to detect files with the same name but different extensions?

  13. 13

    Find files with same name but different content?

  14. 14

    Finding and copying files with same name but different extensions

  15. 15

    zip multiple files with the same name but different extensions

  16. 16

    Delete files same name but different file extension

  17. 17

    Merge files with same name in different folders

  18. 18

    Find files with same name in different folders

  19. 19

    Different static files for the same path but different domains on App Engine

  20. 20

    Are different translation units allowed to define structures with the same name?

  21. 21

    Is it legal to define two methods with the same name but different returning types?

  22. 22

    Is it ok to declare/define a static method in the .cpp only?

  23. 23

    How to implement different working on same function through inline JavaScript

  24. 24

    Initializing static member function pointer to function of same name

  25. 25

    2 files having the same name but different paths => vim thinks they are the same

  26. 26

    Combining files with same name in r and writing them into different files in R

  27. 27

    Combining files with same name in r and writing them into different files in R

  28. 28

    Why define a function prototype, then preprocessor macro with the same name?

  29. 29

    Javascript closure (using parameter name to define an object in the same function)

HotTag

Archive