|
-
April 8th, 2008, 06:16 PM
#1
Platform independent classes
Does anybody know of any good links that discuss designing (or converting) C++ classes that require platform independence (or at least with a set of specific platforms in mind). The idea is to not riddle the code with tons of #ifdef's. In my own mind, a good link that talks about designing such classes should take into consideration calls to library functions that may have slightly different signatures and/or return values on different platforms, different system include files between the various platforms, etc. I seem to be striking out googling for this. Thanks for your help.
-
April 8th, 2008, 06:25 PM
#2
Re: Platform independent classes
So long as you avoid using platform-dependent libraries, and user minimal wrappers where you must do so, it really isn't that hard.
-
April 8th, 2008, 09:53 PM
#3
Re: Platform independent classes
Have a look at the Bridge Design Pattern.
-
April 9th, 2008, 06:35 AM
#4
Re: Platform independent classes
You could create a base interface class with the cross platform functionality but with pure virtual platform dependent functions. Then define platform dependent concrete classes derived from it.
-
April 9th, 2008, 10:04 AM
#5
Re: Platform independent classes
 Originally Posted by JohnW@Wessex
You could create a base interface class with the cross platform functionality but with pure virtual platform dependent functions. Then define platform dependent concrete classes derived from it.
Actually, this is similar to the route I was thinking about taking. I just didn't know whether it would be the best path to start down, that's why I was wondering about other types of solutions that I haven't thought about or just aren't aware of. Thanks for your input.
 Originally Posted by _uj
Have a look at the Bridge Design Pattern.
I'm not familar with this particular design pattern, but I'll take a look at it. Thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|