13.07.2015 Views

BABAR C++ Course Running the Examples - HEPHY

BABAR C++ Course Running the Examples - HEPHY

BABAR C++ Course Running the Examples - HEPHY

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Header files used with definitionHeader files and user codeIn math.h, we have declarationsextern double sqrt(double);extern double sin(double);extern double cos(double);// and many moreIn math.h, we have declarationsextern double sqrt(double);extern double sin(double);extern double cos(double);// and many moreIn math.C, we have definition#include double sqrt(double x) {//return result;}double sin(double x) {//return result;}• #include is like Fortran include• declaration in header files is used in compilation of<strong>the</strong> library function• any mismatch between declaration and definition isflagged as error.in user.C we definition of user code#include double x, y, z, r;//r = sqrt(x*x + y*y + z*z);• use same header file in user code• user code <strong>the</strong>n compiles correctly with implicitconversions as needed<strong>BABAR</strong> <strong>C++</strong> <strong>Course</strong> 36 Paul F. Kunz<strong>BABAR</strong> <strong>C++</strong> <strong>Course</strong> 37 Paul F. Kunz

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!