I have a function that does some work.
hijras
void doSomething(int n);
a.cpp
#include "Ah" void doSomething(int n) { }
If I want to use this function in another source file, the best choice is:
1) include Ah
B.cpp
#include "Ah" void anotherTask() {
2) or use forward declaration (function prototype):
B.cpp
void doSomething(int); void anotherTask() {
There are many tips for using advanced ads as often as possible for classes. So what is best for forward function declaration?
UPD
Well, this is too simple an example.
What to do if there is garbage in the Ah header (regarding B.cpp, which knows nothing about the driver level):
hijras
#include "specific_driver_header.h" #define SPECIFIC_DRIVER_DEFINES 0xF0 void doSomething(int n);
If I include Ah in B.cpp, then B.cpp will not be driver independent or anything like that. Should I use option (2) in this case?
source share