[GRASS-dev] starting GIPE modules insertion in main svn

Glynn Clements glynn at gclements.plus.com
Tue Sep 30 18:41:39 EDT 2008


Yann Chemin wrote:

> > Right; you need <unistd.h> for swab().
> >
> are there forgiving compilers around, so that this was not required explicitely?

By default, "implicit declaration of function ..." only generates a
warning, not an error. However, the resulting binary is likely to
crash if the compiler guesses the function's prototype incorrectly.

IIRC, Markus normally compiles with
-Werror-implicit-function-declaration, which will cause implicit
function definitions to generate an error.

> > Also, the fact that the swab() calls are there seems to imply that the
> > data was imported incorrectly in the first place. If any byte swapping
> > needs to be done, it should normally be done when the data is
> > imported.
> >
> My mastering of binary reading is weak, so I guess you make sense,
> but technically I would feel weak to modify it. For what I undestand
> it was initially meant (outside of GRASS) to isolate a small number
> of bits for & comparison. 

In that case, I'm guessing that the code was designed for a specific
architecture, one whose byte order is opposite to that used by the
data.

Ultimately, if you don't understand the format, or how the code is
supposed to work, it's probably better not to commit it.

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


More information about the grass-dev mailing list