CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2005
    Location
    Denver
    Posts
    353

    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.

  2. #2
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    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.

  3. #3
    Join Date
    Nov 2003
    Posts
    1,405

    Re: Platform independent classes

    Have a look at the Bridge Design Pattern.

  4. #4
    Join Date
    Jul 2002
    Location
    Portsmouth. United Kingdom
    Posts
    2,727

    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.

  5. #5
    Join Date
    Feb 2005
    Location
    Denver
    Posts
    353

    Re: Platform independent classes

    Quote 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.
    Quote 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
  •  





Click Here to Expand Forum to Full Width

Featured