On Jan 19, 2006, at 06:05 , Steve Checkoway wrote:
On Jan 18, 2006, at 11:18 PM, D. Walsh wrote: I'm in the midst of converting some 65C816 source files and I've run into some code that doesn't quite look right to me.
/* Are we using an old or a new library? */ #ifndef _xsco_version && ndef xsco_version #define xsco_version() 1.000511 #endif
Now, from what it appears, it looks like it's testing for the existence of a function but I don't believe this is the correct approach but I could be wrong.
It's testing for the existence of two macros. [I never realized that you could use ndef like that, I would have done #if !defined(...) && !defined(...)]
Anyway, before I create a mess by ignoring this code and since there are roughly about 400 files I thought I'd ask for some opinions and advice on what to do with this code since the files are peppered with them.
It is a little odd though. If _xsco_version is defined but xsco_version is not and no function xsco_version() exists then code such as:
double version = xsco_version();
will fail to compile (or link, I never can tell when Apple's gcc will allow implicit definitions).
If that was meant to test for a function, it's going about it the wrong way (see the GNU autotools for one possible way to test for a function).
A quick search of header files turns up nothing for me:
$ find /usr/include /usr/X11R6/include/ -type f -print0|xargs -0 grep -i xsco_version
You don't have xsco installed, I've got the dev API, header files and libraries under an NDA.
#include <xsco/xsco.h> #include <xsco/xsco_enet.h> #include <xsco/xsco_ata.h> #include <xsco/xsco_scsi.h>
it links against libxsco.so (now libxsco.dylib on my Mac)
Newer versions of the library include xsco_version() which returns a double so doing: double some_variable = xsco_version(); works but in the older libraries this function is not available so it looks like they hard code a value however, this check method doesn't seem to work or locate the available function and even using !defined(xsco_version) didn't work so I'm not sure how to resolve this.
Being an XCode project I'm not sure how to use the autotools to determine if this function exists.
That said, I think you're probably okay just leaving it alone.
Apparently not, it doesn't find library functions using this method and a lot of the application functionality doesn't work. -- Dale |