Author: Ratko V Tomic
Date: 20:58:49 10/07/99
Go up one level in this thread
> But the problem is that I want to write portable code. Tiger is > completely written in C and I don't want to rely on knowledge about > the system, unless it is absolutely necessary. > > In this case, polling the keyboard with the standard kbhit() function, > if done with a long enough time interval, is harmless. So I favour > this solution. Unfortunately, the machines differ and the C standard libary doesn't have kbhit() (it is a Microsoft C extension). I also write code which has to run on Windows (NT/95/98), unix, Mac, etc. and I put all machine dependent stuff into the platform.h header. Due to big-little endian differences, word size differences, pointer size diffrerences, and a requirement for maximum performance on every platform (e.g. some compression & compressed data base search code runs, among others, on AOL servers and gets called many tens of thousands of times every second, i.e. called once for every url any of their users invokes), I had to write specific macros for specific platform. Then I just add compiler command line #defines for the platform while the actual code and header files remain identical. Obviously, that doesn't save any time in writing the actual variants of platform dependent macros or functions (and testing on various platforms), but it does save on all subsequent code which uses them.
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.