Good Practice PDF
Good Practice PDF
Programming Practice
Compiling code
Debugging & Optimising
Maintaining code
Patrick Guio
Outline
3 Compiling code
5 Maintaining code
Even better, avoid label at all and include the format within
the statement
w r i t e ( f i l e I d , " ( ’ Number o f i t e r a t i o n s = ’ , i7 ) " ) i t e r
instead of
i f ( number . l t . 0 ) then
...
else i f ( number . eq . 1 . o r . number . eq . 2 ) then
...
else i f ( number . ge . 3 ) then
...
else
...
end i f
Understanding “Makefile”
“Makefile” contain statements like
t a r g e t : dependencies
command_to_update_target # o p t i o n a l
. cpp . o :
$ (CXX) $ (CXXFLAGS) −o $@ −c $<
# or e q u i v a l e n t l y
%.o : %.cpp
$ (CXX) $ (CXXFLAGS) −o $@ −c $<
Writing a “Makefile”
d e f a u l t : $ (EXECUTABLE)
$ (EXECUTABLE ) : $ (OBJECTS)
$ (FC) $ (FFLAGS) −o $@ $^
%.o : %. f 9 0
$ (FC) $ (FFLAGS) −o $@ $<
Debugging
Optimising
Using cvs
If you make any changes (and you are happy with them),
you can commit your changes into the repository with the
command
% cvs commit [filename(s)]
without forgetting to log your changes.
If you have “checked out” your project on another machine,
you can synchronise these with the following command
% cvs update
Conclusion