jeudi 26 février 2015

Is it bad practice to have static functions with the same name in different C modules?



Bearing in mind this is C code, not C++...


...I have two modules that are doing the same thing, but on different interfaces on my micro. They need to run completely independently.


Is it bad practice to have the same named set of static functions in both files? In other words, almost all of the functions in the two modules are static functions and those that are static have exactly the same name.


I suppose I could even ask, is it good practice!


EDIT: In response to the debate below, here is some [partially pseudo] code:



static void DiscoverUnits(void)
{

InitBus(); // Where this is one of two buses
RandomiseAddresses(); // Again, one of two buses
while (LongSeachAddress < MaximumLongAddress)
{
// Detect units, assign short addresses calling several functions
// all of which are constantly accessing one of two buses
// This could drag on for 20-30s!
}

}



Aucun commentaire:

Enregistrer un commentaire