Re: GLIB_CHECK_VERSION (was: Glib rand() function)



> > > > if (GLIB_CHECK_VERSION (1, 3, 0))
> > > > 	[...use g_rand()...]
> > > > else
> > > > 	[...use rand()...]
> > > 
> 
> Oh, you meant code, not configure.in... this won't work at all, you
> are going to get undefined symbol g_rand().

	That should have read:
#if (GLIB_CHECK_VERSION(1,3,0))
	[...use g_rand()...]
#else
	[...use rand()...]
#endif

	...so the undef'd symbol error shouldn't happen.

> Just use rand(), when you put it in glib you can worry about
> portability....

	One of my goals in writing this data type is learning the Glib
coding style and portability rules.  I.e., I've already named the struct
"GSkipNode" and the functions g_yada_yada(), and am using all the Glib
data types (gint, etc.) and functions (g_malloc(), etc.).

	If I knew what the current 1.3 minor version was I could put the
GLIB_CHECK_VERSION in there and I think it would be Appropriate and
Correct.  Please correct me if I'm wrong (I really am trying to learn the 
"correct" way to do it).


Thanks,
Derek



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]