This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: propose to rename natPlainSocketImpl to natPosixPlainSocketImpl
- From: Bryce McKinlay <bryce at waitaki dot otago dot ac dot nz>
- To: Adam Megacz <gcj at lists dot megacz dot com>
- Cc: java at gcc dot gnu dot org
- Date: Sat, 02 Feb 2002 11:22:46 +1300
- Subject: Re: propose to rename natPlainSocketImpl to natPosixPlainSocketImpl
- References: <86zo2tolwu.fsf@megacz.com> <873d0lg2so.fsf@creche.redhat.com> <86adutmv5s.fsf@megacz.com>
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.