Pedagogy and MPI example code

(no name) (Andrew.Lumsdaine.1@nd.edu)
Tue, 14 Jan 1997 17:09:10 -0500 (EST)

In reading through some of the examples in the current MPI document, I
notice that most (if not all) of the examples involving main() use the
common but incorrect practice of returning from main() without a
value. Main() is declared to be int (or defaults to int with no
declaration). Results are undefined if no value is explicitly
returned by main() -- typically some sort of garbage value is
obtained.

Thus, I would urge all example authors to return a value of 0 from
main() after MPI_Finalize() -- or return MPI_Finalize(). The reasons
for this are more than pedagogical, I think, in the case of MPI. The
return value of main() is returned to the operating system, and may be
checked by invoking processes. It seems that batch systems in
particular might infer failure of a job that did not fail and take
inappropriate action as a result.

Maybe it's just because the term is about to start and I am feeling
the pressure of curious young minds, but it seems that examples in the
document should be examples not only of the particular point being
made at the time, but also of good MPI programming practice.

Best Regards,
Andrew Lumsdaine