[GRASS-dev] char[1024]

Hamish hamish_nospam at yahoo.com
Mon Nov 20 22:42:11 EST 2006

may string variables allocate memory in powers of 2, e.g. char[128] or
char[1024]. Lots of places in GRASS you see char[100] or char[1000] for
buffers. Is there a big advantage to fitting exactly in 1024 bytes for
something like a G_getl() string input buffer?

I remember Glynn recommending the RGBA_Color struct fit into this sort
of 2^space but I didn't pick up why this was important.

ie for a heavily re-used buffer is it a good idea (faster) to use 1024
instead of 1000? is it only important if you are passing it to another fn?
speed of alloc() and free()?


(sorry, only had one fairly useless Comp.Sci. Pascal course in Univ)

More information about the grass-dev mailing list