views:

77

answers:

2

The most common issue for non-OOP is:

how to prevent conflict of function name when the project becomes extremely huge?

For OOP we can simply put the functions into different classes,but what's the approach for procedure programming?

+1  A: 

Namespaces are widely used.

Joonas Pulakka
+4  A: 

In C++, without using OOP, you would use namespaces.

In C, people tend to create functions with prefixes (e.g. "sqlite3_some_function_name") and/or marking non-public functions static.

Anyway, when using long and descriptive names for functions, no two functions will have the same name OR if they do, they're identical and one of them can be removed.

AndiDog
By marking non-public functions static,it's only visible within the very file,right?
Yes, that's right.
AndiDog
Did `c` support `namespace` by the time windows os comes out?
The Windows API defines functions in C, not C++. Only C++ supports namespaces, C still doesn't. That's why I said that in C you'd usually use prefixed function names.
AndiDog
So for c projects,the only approach is "prefixed function names"?
Yes, it's the only bulletproof solution IMO.
AndiDog