Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > portability issues

Reply
Thread Tools

portability issues

 
 
MJL
Guest
Posts: n/a
 
      08-01-2004
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.
 
Reply With Quote
 
 
 
 
Gianni Mariani
Guest
Posts: n/a
 
      08-01-2004
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.

 
Reply With Quote
 
 
 
 
MJL
Guest
Posts: n/a
 
      08-02-2004
http://www.velocityreviews.com/forums/(E-Mail Removed) (MJL) wrote in message news:<(E-Mail Removed). com>...
> 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.
 
Reply With Quote
 
=?ISO-8859-2?Q?Mateusz_=A3oskot?=
Guest
Posts: n/a
 
      08-02-2004
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
 
Reply With Quote
 
David Hilsee
Guest
Posts: n/a
 
      08-02-2004
"MJL" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> (E-Mail Removed) (MJL) wrote in message

news:<(E-Mail Removed). com>...
> > 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


 
Reply With Quote
 
John Torjo
Guest
Posts: n/a
 
      08-02-2004
(E-Mail Removed) (MJL) wrote in message news:<(E-Mail Removed). com>...
> 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
-- (E-Mail Removed)

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)
 
Reply With Quote
 
Gernot Frisch
Guest
Posts: n/a
 
      08-02-2004

> 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



 
Reply With Quote
 
Ioannis Vranos
Guest
Posts: n/a
 
      08-02-2004
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
 
Reply With Quote
 
Ioannis Vranos
Guest
Posts: n/a
 
      08-02-2004
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
 
Reply With Quote
 
Pete Becker
Guest
Posts: n/a
 
      08-02-2004
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)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Portability issues (union, bitfields) Noob C Programming 7 11-06-2009 01:57 AM
reinterpret_cast portability/alignment issues Lionel B C++ 10 01-02-2007 05:48 PM
fread/fwrite Portability Issues Jonathan Lamothe C Programming 20 07-31-2006 05:11 AM
portability issues with ' flag in printf billposer@alum.mit.edu C Programming 17 04-26-2006 03:41 PM
Portability / compatibility issues OzBob C Programming 23 01-16-2006 09:42 PM



Advertisments