>> I'm planning to declare m, tree as extern variables because they are to persist in
>> memory as long as the calculations are being done
That would be the wrong reason since extern has no bearing on the scope of a variable. extern tells the linker to look elsewhere for a variable because it is actually declared in another module.
If the source does what it's meant to there's not much to do here.
Why is exit() so appropriate for main() rather than a simple return statement?
Are you comfortable with how initialize_mesh() is written or could it be refactored? I'm not sure what those functions do but I would rather break it into several statements rather than chain them together with or:
Code:
int rv_read = read_mesh(zfname, m);
int rv_init = init_plwave();
int rv_tree = create_kdtree(tree, *m)
if(rv_read || rv_init || rv_tree )
{
killall(); /* destroy all data structures */
return (1);
}
It's simply cleaner because the functions would always be called top down and their return values could still be used to clean up. But whatever makes sense.