pingus-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Platform Specific Code


From: Ingo Ruhnke
Subject: Re: Platform Specific Code
Date: 21 Oct 2002 22:31:43 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Neil Hotmail <address@hidden> writes:

> | Is this code meant to introduce globally valid names for functions
> | which differ between Linux and Win32? If so it's probably enough
> | add #defines for Win32 into pingus.hxx since it's included by
> | every other header.
>
> This way pingus.hxx would include the appropriate platform specific code, as
> above, the fact that its included by everything should make it a lot easier.
> It will also make it shorter when Pingu's gets ported to 50 OS's.
 
'pingus.hxx' is only meant for the little quirks and itches, its not
meant as an OS abstraction layer. So any function definitons should
not go there but into the correct header file.

>> Also: system.cxx is badly implemented in my opinion - would it not be
>> better to have separate files for each OS implementing system?
> | That would quite likely be a superior implementation.

Most likly it should be done like this:

system.hxx -  Defines API
system_impl.hxx - Parent class for implementations
win32_system_impl.hxx - Win32 impl.
posix_system_impl.hxx - POSIX impl.

System (SystemImpl* i) : impl (i) {}
void System::do_something() { impl-> do_something(); }

But anyway, system.[ch]xx is ugly and seperating it into two files
won't make it much nicer. system.[ch]xx was after all just the dumping
place for things that doesn't fit elsewhere. Most of the stuff in
system.[ch]xx could be replaced by a nice filesystem abstraction
layer, which we might need anyway if we want stuff like transparantly
accessing the content of a tar.gz or things like that.

-- 
WWW:      http://pingus.seul.org/~grumbel/ 
Games:    http://pingus.seul.org/~grumbel/gamedesigns/
JabberID: address@hidden 
ICQ:      59461927




reply via email to

[Prev in Thread] Current Thread [Next in Thread]