propose to rename natPlainSocketImpl to natPosixPlainSocketImpl
Bryce McKinlay
bryce@waitaki.otago.ac.nz
Fri Feb 1 14:23:00 GMT 2002
Adam Megacz wrote:
>What do you all think of merging all the platform-specific files into
>a single natXXX.cc file per class, and a single .java file per class,
>using #ifdefs for platform-specific stuff.
>
In general I think it is a bad idea. In the cases where most/all of the
code is different (xxx-threads, etc), #ifdefs would just make the files
long and confusing.
>As far as I can tell, the code overlap rules aren't too simple. If you
>force each platform to have a seperate file, you wind up with a lot of
>code duplication. By keeping all the code for java.io.File in one
>place, you can use #ifdefs to control code sharing -- sometimes Win32
>and POSIX use the same code, other times they don't.
>
In cases where much of the implementation is the same, but a few key
functions are different (eg natSystem.cc), an alternative would be to
have a .cc and .h file at the top level (posix.cc/posix.h,
win32.cc/win32.h, etc) which contain implementations of various
platform-specific functions, much the same way as the threads/GC
interface works currently. This way there is a clean separation of what
needs to be ported to get libgcj running on a new platform. On the other
hand, its easy to imagine platforms that are mostly-posix but differ in
a few key areas (eg file system), or mostly win32 but a bit different
(winCE), so it could be that #ifdefs would be required even inside posix.cc.
regards
Bryce.
More information about the Java
mailing list