pstolarc at theperlguru.com wrote: > > I'm currently working on porting the client common files over to win32. > These are the changes I've made so far. In all instances, the original > code is in the else half of the #ifdef/#else/#endif. Oh, and it's > necessary to define #CF_WIN32 in config.h when compiling under win32. > > I'm not done going through everything, but with these changes, there seem > to be only a few niggling incompatibilities left. It doesn't build yet, > but almost. And I know, the sprintf with only constants isn't really > necessary, but it seems more readable to me. Any reason you just can't redefine DATADIR in the case of the CF_WIN32 instance? Can't remember if DATADIR is used for other stuff, but there are probably other areas that may use some unix type features. > > I'm wondering, would it be better to have these inline with #ifdef > wrappers, or as seperate files, ie. "metaserver-w32.c", and forget the > #ifdefs? Also, do any of the changes I made to get it to work relate to > any other OSes, that we will eventually target? Given the number of #ifdef blocks you current have, proabably inlining it is OK. If there were cases where a large portion of the file was ifdef'd, then maybe a seperate file. Also, my personal opinion is that #ifdef/else isn't too bad for good sized blocks. What I found annoying in the server code is cases where you had a bunch of things like ifdef <few lines> else <few lines> endif <few more lines of code that are common ifdef <few lines> else <few lines> endif etc, such that it became really hard to read through the function to see what it was doing, because not only did you have to try to parse the code, but you also had to parse the ifdefs. So I tended to prefer longer ifdef/else/endif, even if they included some common code. Well, beyond unix and windows, the next big one would probably be macos. I know the newer versions are more unix like, so maybe won't be as much of a problem. Dunno -it really depends on the next person who tries to port it to something new.