[GRASS-dev] r.random still broken on Mac

Glynn Clements glynn at gclements.plus.com
Thu Sep 28 13:20:09 EDT 2006


Michael Barton wrote:

> r.random is broken on the Mac at least. It jams all the points into the top
> edge of the screen instead of actually randomly distributing them. I thought
> this was fixed months back. If it was, it¹s broken again and needs to be
> fixed for GRASS 6.2.
> 
> This happens with both vector and raster points, and both from the GUI and
> command line.

Probably because the "fix" tries to identify specific platforms rather
than testing the HAVE_DRAND48 macro:

	#if defined(__CYGWIN__) || defined(__APPLE__) || defined(__MINGW32__)
	#define lrand48() ((long)((double) rand() * (1<<31) / RAND_MAX))
	#define srand48(sv) (srand((unsigned)(sv)))
	#else
	extern long lrand48();
	extern void srand48();
	#endif 

I'm guessing that the OSX compiler doesn't define __APPLE__ any more.

In general: platform tests are a bad idea. Test the features which you
actually want to use. If you need a configure test, and don't know how
to write it yourself, make a request to the list.

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




More information about the grass-dev mailing list