forked from OSGeo/grass
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmigration_50_51.txt
55 lines (39 loc) · 1.75 KB
/
migration_50_51.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
Rules to migrate GRASS 5.0 modules into GRASS 5.7
Date: 2003-09-11
While implementing GRASS 5.7 a major cleanup of GRASS modules
has to be done. The following rules shall help the programmer
to migrate a 5.0 module into the 5.7 environment.
1. Add GPL statement
2. Programming details:
o String buffer length:
- to be identical for all modules
o consistent return types. Situation in 5.0:
The majority of functions return 0 on error and 1 on success, but there
are many which return 0 on success and a negative value on failure.
Proposal for 5.7? see below
o Copying input parameters into a buffer, i.e.:
strcpy (name, option.input->answer);
strcpy (result, option.output->answer);
is usually unnecessary. Furthermore, it's something which should be
discouraged, due to the usual problems with fixed-size buffers.
o Pre-formatting error/warning messages, e.g.:
if (mapset == NULL)
{
char buf[200];
sprintf (buf, "cell file [%s] not found", name);
G_fatal_error (buf);
}
is unnecessary, as G_fatal_error() and G_warning() already do this,
e.g.
if (!mapset)
G_fatal_error("cell file [%s] not found", name);
o Ideally, all abnormal exits would be via G_fatal_error(), rather
than calling exit() directly.
o The value passed to exit() should be non-negative. exit(-1) is just
a confusing way of writing exit(255).
o C++ style comments are forbidden for portability reasons:
use /* comment */ but NOT //comment
3. Style of file: We can reach pretty indenting through:
indent -i4 -npsl -di0 -br -nce -d0 -cli0 -npcs -nfc1 FILE.c
This should be done before uploading.
... to be extended...