ps.map on Solaris 2.5

Justin Hickey jhickey at impact1.hpcc.nectec.or.th
Tue Oct 22 08:00:00 EDT 1996



On Oct 22,  9:52am, Iwao NODA wrote:
> And , may I ask you ?  I had many warnings as below when I compiled
> GRASS4.1.5 with gcc on Solaris2.5.( however the installation was done)  Is
> that ok ?  I worry that grass-commands might generate wrong results.
> Thank you for your kindness.
>

Iwao:

I know most people ignore warnings from compilers and it is true that some of
the warnings can be ignored. However, it has been my experience that warnings
concerning pointers, especially incompatible pointer warnings, require at least
an investigation to see what the problem is.

If the pointer types are incompatible then what is usually happening is that a
pointer of one type is being passed to a function that expects a pointer of
another type. The danger in this case is that other variables in memory can be
overwritten since the pointers can point to different sized data.
Unfortunately, C pointers being the nasty (but powerful) beasts that they are,
will happily overwrite other variables in memory without complaint. For
example, I once came across some code that passed a structure pointer to a
function that expected a char pointer. I have no idea what would happen when
this function would be called since the structure information would be lost and
depending on what the function did with the char pointer, the information could
easily be overwritten. The compiler in this case only warned me of the
incompitable pointers.

In general, all warnings concerning pointers should be investigated since
pointers can easily produce incorrect results if the programmer was not
careful.

As for the warnings concerning the 'extern' and 'static' declarations, I'm not
sure of the implications if this warning is ignored but it is relatively easy
to fix. Simply determine wheather the variable should be 'extern' or 'static'
and change the declaraions appropriately. In general if a variable is used in
more than one source file (.c file) then it should be declared 'extern'. If the
variable is only referenced in a single file then the 'extern' declaration can
be deleted. If you don't have the time to investigate the situation then in
most cases, changing the 'static' declaration to 'extern' will not usually
cause problems.

If you need further explanation about pointers and the problems they can solve,
or C programming in general, then we can continue this discussion in private
e-mail.

Hope this is helpful to you.

> .....
> GISGEN: src/libes/vask - 1996..... JST
>
> #################################################################
> /export/home/grass415/src/libes/vask
>   mkdir OBJ
>   make -f OBJ/make.rules
>
> rm -f OBJ/V_call.o
> gcc -O  -I/export/home/grass415/src/include -DUSE_TERMIO -c V_call.c
> V_call.c:390: warning: `fmt' was declared implicitly `extern' and later
 `static'
> V_call.c:409: warning: `centered' was declared implicitly `extern' and
> later `static'
> mv V_call.o OBJ/V_call.o
> rm -f OBJ/V_clear.o
> gcc -O  -I/export/home/grass415/src/include -DUSE_TERMIO -c V_clear.c
> mv V_clear.o OBJ/V_clear.o
> .....
> rm -f OBJ/get.o
> gcc -O  -I/export/home/grass415/src/include -DUSE_TERMIO -c get.c
> mv get.o OBJ/get.o
> rm -f OBJ/get_row.o
> gcc -O  -I/export/home/grass415/src/include -DUSE_TERMIO -c get_row.c
> mv get_row.o OBJ/get_row.o
> rm -f OBJ/init.o
> gcc -O  -I/export/home/grass415/src/include -DUSE_TERMIO -c init.c
> init.c:34: warning: `read_int' was declared implicitly `extern' and later
> `static'
> mv init.o OBJ/init.o
> rm -f OBJ/pagein.o
> gcc -O  -I/export/home/grass415/src/include -DUSE_TERMIO -c pagein.c
> pagein.c:55: warning: `segment_select' was declared implicitly `extern' and
> later `static'
> mv pagein.o OBJ/pagein.o
> rm -f OBJ/pageout.o
> gcc -O  -I/export/home/grass415/src/include -DUSE_TERMIO -c pageout.c
> mv pageout.o OBJ/pageout.o
> rm -f OBJ/put.o
> .......
> rm -f OBJ/io.o
> gcc -O -I/export/home/grass415/src/display/devices/lib
> -I/export/home/grass415/src/include -DUSE_TERMIO -c io.c
> io.c:290: warning: `fifoto' was declared implicitly `extern' and later
 `static'
> io.c: In function `fifoto':
> io.c:296: warning: passing arg 2 of `signal' from incompatible pointer type
> io.c:300: warning: passing arg 2 of `signal' from incompatible pointer type
> io.c:305: warning: passing arg 2 of `signal' from incompatible pointer type
> io.c:309: warning: passing arg 2 of `signal' from incompatible pointer type
> io.c: At top level:
> io.c:322: warning: `sync_driver' was declared implicitly `extern' and later
> `static'
> io.c: In function `sync_driver':
> io.c:340: warning: passing arg 2 of `signal' from incompatible pointer type
> io.c:362: warning: passing arg 2 of `signal' from incompatible pointer type
> io.c:371: warning: passing arg 2 of `signal' from incompatible pointer type
> io.c: At top level:
> io.c:380: warning: `dead' was declared `extern' and later `static'
> io.c: In function `_hold_signals':
> io.c:396: warning: passing arg 2 of `signal' from incompatible pointer type
> io.c:397: warning: passing arg 2 of `signal' from incompatible pointer type
> io.c: At top level:
> io.c:443: warning: `lockfile' was declared implicitly `extern' and later
> `static'
> .....
>
> ----
-- End of excerpt from Iwao NODA


-- 
Sincerely,

Jazzman (a.k.a. Justin Hickey)
High Performance Computing Center
National Electronics and Computer Technology Center (NECTEC)
Bangkok, Thailand
==================================================================
People who think they know everything are very irritating to those
of us who do.  ---Anonymous

Jazz and Trek Rule!!!
==================================================================





More information about the grass-dev mailing list