[GRASS-dev] storing pointers in CELL_TYPE maps?

Volker Wichmann wichmann at laserdata.at
Fri Apr 27 05:06:21 EDT 2007

Glynn Clements wrote:
> Volker Wichmann wrote:
> > I'd like to store pointers in CELL_TYPE maps. These pointers contain the
> > adresses of the first element of linked lists (containing special
> > attributes for each cell of the raster map). This works out fine on my
> > machine, but I'm afraid this might not be the case on others. Is it safe
> > or just an ugly hack?
> What do you mean by "store"? Storing pointers in files is usually
> pointless, as they are normally only useful so long as the original
> process persists.
> If you're talking about storing them in memory in CELL arrays,

yes, that's what I meant to say

>  that
> won't normally work on 64-bit systems, where a CELL (i.e. "int") is 32
> bits but pointers are 64 bits.

ok, damn ;-)

> If the list nodes are of fixed size, it's likely to be better to have
> a single array of nodes and uses indices to reference individual
> nodes.

that's my problem: I don't know the size of the array at compile time,
so I have to dynamically allocate memory. My idea was to use the GRASS
API to do that, but it seems I have to do this on my own. Or do you know
of another way?

I'm quite new to GRASS programming, but having something like
pointer("CELL") arrays would offer a lot of possibilities!

Thanks a lot!


More information about the grass-dev mailing list