NVIZ2.2

Luca Palmeri lpalmeri at ux1.unipd.it
Thu Sep 16 06:12:26 EDT 1999


Hi Jacques, Markus, Jaro and Michel

I think this discussion has gone a littlebit too further.
As a conclusion I would suggest:

1) printf () vs.  fprintf(stdout,"") substitution is a good programming
practice, but
    not fprintf(stderr,""), unless a real error has to be reported.

2) add return 0, when main is declared as int. Uncle Kerningam will
appreciate.

In this case of Nviz2.2 bug, Jaques is right. My pach is only a
roundabout, the
real fix is add return 0 at the end of main in main.c for g.gisenv.
Please note that doing so in mapBrowser.tcl there is no more need to
define
an internal proc g.gisenv to catch the error returned by GRASS g.gisenv;

and so we have a cleaner code.

cheers
LP

Jacques Bouchard wrote:

> The real problem in g.gisenv, when used from nviz (or from
> any TCL/TK program, is that it doesn't contain any return
> statement, although the type of the function "main" is "int":
>
> this is certainly no good programming style!
>
> So the value returned by the function "main" is undefined and
> depends on the C implementation:
>
> - if it is always 0: no problem: nviz will always work too
>
> - if it is <> 0, the OS (and TCL) thinks the binary "g.gisenv"
>   hasn't worked properly, hence the value returned by the
>   procedure "g.gisenv" in "mapBrowser.tcl" contains an error
>   message that prevents the map browser of nviz to work
>   (unless the error message is removed, as Luca Palmeri suggests).
>
> So, please, insert a "return 0;" before the last line in
> "g.gisenv/main.c".
>
> Jacques Bouchard



More information about the grass-user mailing list