[GRASS-dev] Some doubts

Dear all,
I have some questions that I would like to resolve.

This summer I was discussing with Markus about extern variables. He told me that there were some compilation problems and it would be better not to use them. But I saw that they are used all over GRASS. So, which is the point with them? Should they be declare in an especial way?

There is a second question about the database and driver module's options. When I wrote my modules (v.surf.bspline, v.outlier and v.lidar.*) I needed the database and driver information. I decide to ask the user for them in the case he/she wants to use other than the default values. But, is better to ask the user for these parameters within the module, or maybe is better to use the default values?

A third final question: To show the progress of the module, is actually needed?

Thank you a lot,
Roberto.

--
Roberto Antolin Sanchez
Politecnico di Milano – Polo Regionale di Como
Via Valleggio, 11 – 22100 Como, Italy
tel: +39 031 3327533
email: roberto.antolin@polimi.it

Roberto Antolin wrote:

I have some questions that I would like to resolve.

This summer I was discussing with Markus about extern variables. He told
me that there were some compilation problems and it would be better not
to use them. But I saw that they are used all over GRASS. So, which is
the point with them? Should they be declare in an especial way?

Ideally, you should structure your code so as to minimise the need for
variables to be exported. Beyond that, exported variables should avoid
"trivial" names, as they are more likely to conflict.

If a module is particularly complex and requires a significant number
of variables to be visible throughout the module, it might be worth
encapsulating them into a structure to minimise the number of exported
symbols.

There is a second question about the database and driver module's
options. When I wrote my modules (v.surf.bspline, v.outlier and
v.lidar.*) I needed the database and driver information. I decide to ask
the user for them in the case he/she wants to use other than the default
values. But, is better to ask the user for these parameters within the
module, or maybe is better to use the default values?

The user should set the database parameters using db.connect. There
shouldn't be any reason for individual modules to use anything other
than the current database.

A third final question: To show the progress of the module, is actually
needed?

It depends upon typical execution times. If a module might take more
than a few seconds, and deriving an estimate of completion is
straightforward, it's a good idea to use G_percent() to indicate
progress.

--
Glynn Clements <glynn@gclements.plus.com>