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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CommentsMain programTwo forms of comments allowed (ch2/comments.C)• Tradition C style/* This is a comment *//** This is a multiline* comment*/a = /* ugly comment */ b + c;• New <strong>C++</strong> style (also Objective-C)// This is a comment//// This is a multiline// comment//a = b + c; // comment after an expressionAll programs must have a mainMost trivial is (ch2/trivial.C)int main() {return 0;}• under UNIX, suffix is .C or .cc• main() is a function called by <strong>the</strong> OS• this main() takes no arguments• braces (“{” and “}” ) denote body of function• main returns 0 to <strong>the</strong> OS (success!)• a statement ends with semi-colon (“;”), o<strong>the</strong>rwisecompletely free form• same rules as C (except .c suffix is used)Computing group recommends <strong>C++</strong> style<strong>BABAR</strong> <strong>C++</strong> <strong>Course</strong> 3 Paul F. Kunz<strong>BABAR</strong> <strong>C++</strong> <strong>Course</strong> 4 Paul F. Kunz

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

Saved successfully!

Ooh no, something went wrong!