???2?52pm?@bnr.ca>
content-type: text/plain; charset=us-ascii
organization: University of Illinois at Urbana
mime-version: 1.0
reply-to: grassu-list@pandora.cecer.army.mil
newsgroups: info.grass.user
originator: daemon@ux1.cso.uiuc.edu
BTW out of curiosity does anyone know why the GRASS
developers felt the need to reimplement there own
version of calloc (and malloc, strcat etc)
Michael Shapiro can explain this better than me (and maybe correctly to boot)_,
but here goes:
G_malloc(), C_calloc(), etc exist to give GRASS better error control for their
functions. If you use G_malloc() and the computer runs out of memory,
G_malloc() will send the appropriate information to G_fatal_error().
G_fatal_error is the "proper" way to exit a GRASS program that fails.
Otherwise, good programming would require the programmer to write:
Buf = malloc( G_window_cols() * sizeof( CELL));
if( Buf == NULL) {
printf("%s: Ran out of memory\n", G_program_name());
exit( /* the proper "this program failed" number */)
}
instead of:
Buf = G_malloc( ...)
chuck
--
Charles Ehlschlaeger, Assistant Research Professor chuck@geo.swf.uc.edu
Department of Geography (131) work: 513-556-2849
University of Cincinnati fax: 513-556-3370
Cincinnati, OH 45221 http://geo.swf.uc.edu/~chuck