portability issues

Discussion in 'C++' started by MJL, Aug 1, 2004.

  1. MJL

    MJL Guest

    I am trying to figure out how to make my code as portable as possible.
    I do not really use much of the STL. I could get by with a linked
    list of strings. Microsoft does provide an object list and a string
    list class but then I have to rewrite my code when using Borland or
    other environments.

    The other problem is GUIs. I know it is best to separate the
    functional code from the visual interface code, but that still leaves
    a lot of work to do when porting to another platform. Maybe the GUI
    concept is over-rated and can be done away with for programs used in
    the workplace that have to be functional but not pretty.

    So to be most portable, I will write a linked list of strings class
    and minimize use of GUI components. Any other ideas?

    I am not going to:

    1) Switch to Java.
    2) Buy a library to supplement a deficient one.

    Maybe it does pay to re-invent the wheel occasionally.
    MJL, Aug 1, 2004
    #1
    1. Advertising

  2. MJL wrote:
    > I am trying to figure out how to make my code as portable as possible.
    > I do not really use much of the STL.


    The STL is once of those things that is portable, you should use it.

    I could get by with a linked
    > list of strings. Microsoft does provide an object list and a string
    > list class but then I have to rewrite my code when using Borland or
    > other environments.


    Not so if you use the std::string and std::list !

    >
    > The other problem is GUIs. I know it is best to separate the
    > functional code from the visual interface code, but that still leaves
    > a lot of work to do when porting to another platform. Maybe the GUI
    > concept is over-rated and can be done away with for programs used in
    > the workplace that have to be functional but not pretty.


    Take a look at some GUI libraries, e.g. wxwindows.

    >
    > So to be most portable, I will write a linked list of strings class
    > and minimize use of GUI components. Any other ideas?
    >
    > I am not going to:
    >
    > 1) Switch to Java.
    > 2) Buy a library to supplement a deficient one.
    >
    > Maybe it does pay to re-invent the wheel occasionally.


    There are alot of copies of wheels out there.
    Gianni Mariani, Aug 1, 2004
    #2
    1. Advertising

  3. MJL

    MJL Guest

    (MJL) wrote in message news:<>...
    > I am trying to figure out how to make my code as portable as possible.
    > I do not really use much of the STL. I could get by with a linked
    > list of strings. Microsoft does provide an object list and a string
    > list class but then I have to rewrite my code when using Borland or
    > other environments.


    Sorry for the confusion. In editing my post, I must have deleted the
    first line or two by accident. One of my favorite platforms to write
    for is Microsoft Pocket PC. I use Embedded Visual C++ because it is
    free and I don't want to learn Visual Basic which is the other option
    for PPC. The thing I really like about EVC++ is that I can compile an
    executable that can be put on the device via infrared or memory card
    and run without installation via a desktop PC.

    The problem with Microsoft's EVC++ platform is that it does not
    include the STL. Of course, the desktop version of VC++ and Borland's
    C++ Builder and every other compiler do include it. This creates the
    situation where if I use STL code in a desktop program, I have to
    rewrite it for my Pocket PC version.

    I agree that a better solution would be for microsoft to not leave out
    important features of standard C++. I hope that other hand helds come
    out with other, better OS's installed. A new apple Newton would be
    ideal if they make it as close as possible to OS X.
    MJL, Aug 2, 2004
    #3
  4. On 8/2/2004 5:05 AM, MJL wrote:
    > I use Embedded Visual C++ because it is
    > free and I don't want to learn Visual Basic which is the other option
    > for PPC.


    The third one is to use .NET CF and C# or VB .NET but
    I don't recommend it for Pocket PC, simply C++ is the best.
    Personaly, I don't like .NET ;-)

    > The problem with Microsoft's EVC++ platform is that it does not
    > include the STL.


    Wrong ! SDK for Pocket PC 2002 does not include STL,
    but SDK for Pocket PC 2003 does. Simply, install eVC++ 4.0.
    I mainly use eVC++ 4.0 because it is better, more C++ standard
    compliant and only the PPC 2003 is sell on the market, but
    that's another story.

    I use STL ported by Giuseppe Govi:

    http://www.pocketpcdn.com/libraries/stl.html

    It works great in eVC++ 3.0 and eVC++ 4.0 too.
    I strongly recommend this port of STL.

    > This creates the
    > situation where if I use STL code in a desktop program, I have to
    > rewrite it for my Pocket PC version.


    No, you don't have to rewrite it.
    In my company, we developed GIS component (not COM/ActiveX) using
    STL, and it compiles on desktop Windows and on UNIX/Linux
    without any changes.

    So, for better compliance with C++ standard I use
    Entrek patch for RTTI and C++ exceptions handling.
    I don't use Structured Exceptions Handling (SEH) at all.

    Greets

    --

    Mateusz £oskot
    mateusz at loskot dot net
    =?ISO-8859-2?Q?Mateusz_=A3oskot?=, Aug 2, 2004
    #4
  5. MJL

    David Hilsee Guest

    "MJL" <> wrote in message
    news:...
    > (MJL) wrote in message

    news:<>...
    > > I am trying to figure out how to make my code as portable as possible.
    > > I do not really use much of the STL. I could get by with a linked
    > > list of strings. Microsoft does provide an object list and a string
    > > list class but then I have to rewrite my code when using Borland or
    > > other environments.

    >
    > Sorry for the confusion. In editing my post, I must have deleted the
    > first line or two by accident. One of my favorite platforms to write
    > for is Microsoft Pocket PC. I use Embedded Visual C++ because it is
    > free and I don't want to learn Visual Basic which is the other option
    > for PPC. The thing I really like about EVC++ is that I can compile an
    > executable that can be put on the device via infrared or memory card
    > and run without installation via a desktop PC.
    >
    > The problem with Microsoft's EVC++ platform is that it does not
    > include the STL. Of course, the desktop version of VC++ and Borland's
    > C++ Builder and every other compiler do include it. This creates the
    > situation where if I use STL code in a desktop program, I have to
    > rewrite it for my Pocket PC version.
    >
    > I agree that a better solution would be for microsoft to not leave out
    > important features of standard C++. I hope that other hand helds come
    > out with other, better OS's installed. A new apple Newton would be
    > ideal if they make it as close as possible to OS X.


    Given your situation, you may want to consider creating or reusing some
    STL-like foundation that you can use on both of your target platforms. If
    the STL is not present on a platform that you wish to run your code, then
    you might be able to write some containers and algorithms that are very
    similar to the STL and use those instead. While those classes will probably
    not be as robust as a full-fledged STL implementation, it's a reasonable
    approach for maintaining portability. Another approach would be to use a
    free, portable library, like STLPort. In the end, any of those approaches
    may make porting easier, and they could also make your code more readable
    for those that are familiar with the STL or your chosen library.

    --
    David Hilsee
    David Hilsee, Aug 2, 2004
    #5
  6. MJL

    John Torjo Guest

    (MJL) wrote in message news:<>...
    > I am trying to figure out how to make my code as portable as possible.
    > I do not really use much of the STL. I could get by with a linked


    maybe you should ;) There's a lot to be gained by using STL:
    vectors,lists,strings,etc. and most importantly: algorithms.

    > list of strings.


    std::list<std::string> for instance.

    > Microsoft does provide an object list and a string


    how do you want to be portable, if you use Microsoft's classes? ;)

    > list class but then I have to rewrite my code when using Borland or
    > other environments.
    >
    > The other problem is GUIs. I know it is best to separate the
    > functional code from the visual interface code, but that still leaves
    > a lot of work to do when porting to another platform. Maybe the GUI


    There are a lot of free cross-platform libraries out-there. But if you
    need RAD, I don't think cross-platform is the way to go...

    > concept is over-rated and can be done away with for programs used in
    > the workplace that have to be functional but not pretty.


    I'm not sure what you mean.
    >
    > So to be most portable, I will write a linked list of strings class
    > and minimize use of GUI components. Any other ideas?


    Again, you can use STL. And on top of it, use boost (www.boost.org) -
    there are a lot of excellent libraries out there. I recommend
    boost::function, boost::bind, boost::date_time, boost::filesystem,
    boost::format, boost::smart_ptr to get you started.

    Note that boost is ported across a lot of compilers.

    Best,
    John

    John Torjo
    Freelancer
    --

    Contributing editor, C/C++ Users Journal
    -- "Win32 GUI Generics" -- generics & GUI do mix, after all
    -- http://www.torjo.com/win32gui/

    Professional Logging Solution for FREE
    -- http://www.torjo.com/code/logging.zip (logging - C++)
    -- http://www.torjo.com/logview/ (viewing/filtering - Win32)
    -- http://www.torjo.com/logbreak/ (debugging - Win32)
    (source code available)
    John Torjo, Aug 2, 2004
    #6

  7. > The third one is to use .NET CF and C# or VB .NET but
    > I don't recommend it for Pocket PC, simply C++ is the best.
    > Personaly, I don't like .NET ;-)


    Add me to that list, too.


    > > The problem with Microsoft's EVC++ platform is that it does not
    > > include the STL.

    >
    > Wrong ! SDK for Pocket PC 2002 does not include STL,
    > but SDK for Pocket PC 2003 does. Simply, install eVC++ 4.0.
    > I mainly use eVC++ 4.0 because it is better, more C++ standard
    > compliant and only the PPC 2003 is sell on the market, but
    > that's another story.


    I used the eVC++4.0 to compile for CE3.0 and PPC2000, but now I'm
    using the GCC from:
    http://mamaich.kasone.com/fr_pocket.htm
    and it prodces way faster code than the MS compilers.

    > I use STL ported by Giuseppe Govi:
    >
    > http://www.pocketpcdn.com/libraries/stl.html
    >
    > It works great in eVC++ 3.0 and eVC++ 4.0 too.
    > I strongly recommend this port of STL.


    There's a lot of free stl ports out there. I think they're all quite
    good, since everyone is looking for benefits of the others and
    implements it sooner or later.

    > > This creates the
    > > situation where if I use STL code in a desktop program, I have to
    > > rewrite it for my Pocket PC version.

    >
    > No, you don't have to rewrite it.
    > In my company, we developed GIS component (not COM/ActiveX) using
    > STL, and it compiles on desktop Windows and on UNIX/Linux
    > without any changes.


    If you start your project with the will to port, it will not become
    any problem. If, however, you already have a project based on e.g.
    MFC, you're better off rewriting it completely.

    -Gernot
    Gernot Frisch, Aug 2, 2004
    #7
  8. MJL wrote:

    > I am trying to figure out how to make my code as portable as possible.



    By sticking to ISO C++ code.



    > I do not really use much of the STL. I could get by with a linked
    > list of strings. Microsoft does provide an object list and a string
    > list class but then I have to rewrite my code when using Borland or
    > other environments.




    Use the standard library instead.



    > The other problem is GUIs. I know it is best to separate the
    > functional code from the visual interface code,



    ISO C++ code from system-specific code.




    > but that still leaves
    > a lot of work to do when porting to another platform. Maybe the GUI
    > concept is over-rated and can be done away with for programs used in
    > the workplace that have to be functional but not pretty.



    GUIs differ from platform to platform where "platforms" here can even be
    different APIs on the same system.



    > So to be most portable, I will write a linked list of strings class
    > and minimize use of GUI components. Any other ideas?



    Use the standard library.






    Regards,

    Ioannis Vranos

    http://www23.brinkster.com/noicys
    Ioannis Vranos, Aug 2, 2004
    #8
  9. MJL wrote:

    > The problem with Microsoft's EVC++ platform is that it does not
    > include the STL.



    Then EVC++ is lame.:)



    > Of course, the desktop version of VC++ and Borland's
    > C++ Builder and every other compiler do include it. This creates the
    > situation where if I use STL code in a desktop program, I have to
    > rewrite it for my Pocket PC version.



    Use some third party STL implementation like Boost or STLPort or other.



    > I agree that a better solution would be for microsoft to not leave out
    > important features of standard C++.



    As far as I know in the upcoming VS development for mobile devices will
    be supported (via the support of mobile .NET or how it is called). So
    you will be able to use STL (and the rest of C++ standard library) with
    that.


    > I hope that other hand helds come
    > out with other, better OS's installed. A new apple Newton would be
    > ideal if they make it as close as possible to OS X.



    Well as far as I know there must be some GNU/Linux distributions out
    there for your device. :)






    Regards,

    Ioannis Vranos

    http://www23.brinkster.com/noicys
    Ioannis Vranos, Aug 2, 2004
    #9
  10. MJL

    Pete Becker Guest

    MJL wrote:
    >
    > The problem with Microsoft's EVC++ platform is that it does not
    > include the STL. Of course, the desktop version of VC++ and Borland's
    > C++ Builder and every other compiler do include it. This creates the
    > situation where if I use STL code in a desktop program, I have to
    > rewrite it for my Pocket PC version.
    >


    Our library is available for EVC++. It's not free, however.

    --

    Pete Becker
    Dinkumware, Ltd. (http://www.dinkumware.com)
    Pete Becker, Aug 2, 2004
    #10
  11. On 8/2/2004 11:01 AM, Gernot Frisch wrote:
    >> I mainly use eVC++ 4.0 because it is better, more C++ standard
    >> compliant and only the PPC 2003 is sell on the market, but
    >> that's another story.

    >
    > I used the eVC++4.0 to compile for CE3.0 and PPC2000, but now I'm
    > using the GCC from:
    > http://mamaich.kasone.com/fr_pocket.htm
    > and it prodces way faster code than the MS compilers.


    I have to check it.
    Thanks for that info.

    >> I use STL ported by Giuseppe Govi:
    >>
    >> http://www.pocketpcdn.com/libraries/stl.html
    >>
    >> It works great in eVC++ 3.0 and eVC++ 4.0 too.
    >> I strongly recommend this port of STL.

    >
    > There's a lot of free stl ports out there. I think they're all quite
    > good, since everyone is looking for benefits of the others and
    > implements it sooner or later.


    Yes, I use Giuseppe's por because it is well working and
    - as you can read on eVC++ forum http://www.pocketpcdn.com/forum/ - it
    is very good and supports almost all STL features (no exceptions,
    no streams).

    >> No, you don't have to rewrite it.
    >> In my company, we developed GIS component (not COM/ActiveX) using
    >> STL, and it compiles on desktop Windows and on UNIX/Linux
    >> without any changes.

    >
    > If you start your project with the will to port,


    Right, we started development with portability in mind.
    All classes are implemented as OS independent,
    but we had to implement some Facades and Adapters
    for specific OS API like device context, etc.

    Greets

    --

    Mateusz £oskot
    mateusz at loskot dot net
    =?ISO-8859-2?Q?Mateusz_=A3oskot?=, Aug 2, 2004
    #11
  12. MJL

    MJL Guest

    > > The problem with Microsoft's EVC++ platform is that it does not
    > > include the STL.

    >
    > Wrong ! SDK for Pocket PC 2002 does not include STL,
    > but SDK for Pocket PC 2003 does. Simply, install eVC++ 4.0.
    > I mainly use eVC++ 4.0 because it is better, more C++ standard
    > compliant and only the PPC 2003 is sell on the market, but
    > that's another story.


    If this is true, than I apologize for bringing up a problem that has
    been resolved because I am behind on updating my compiler. Thanks to
    all for helpful responses.
    MJL, Aug 4, 2004
    #12
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. OzBob

    Portability / compatibility issues

    OzBob, Jan 15, 2006, in forum: C Programming
    Replies:
    23
    Views:
    821
    Keith Thompson
    Jan 16, 2006
  2. Replies:
    17
    Views:
    798
    Kevin Handy
    Apr 26, 2006
  3. Jonathan Lamothe

    fread/fwrite Portability Issues

    Jonathan Lamothe, Jul 22, 2006, in forum: C Programming
    Replies:
    20
    Views:
    1,156
    Dave Thompson
    Jul 31, 2006
  4. Lionel B
    Replies:
    10
    Views:
    918
    Lionel B
    Jan 2, 2007
  5. Noob

    Portability issues (union, bitfields)

    Noob, Nov 4, 2009, in forum: C Programming
    Replies:
    7
    Views:
    1,033
    John Temples
    Nov 6, 2009
Loading...

Share This Page