portability issues

M

MJL

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.
 
G

Gianni Mariani

MJL said:
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.
 
M

MJL

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.
 
?

=?ISO-8859-2?Q?Mateusz_=A3oskot?=

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
 
D

David Hilsee

MJL said:
(e-mail address removed) (MJL) wrote in message

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.
 
J

John Torjo

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 said:
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 address 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)
 
G

Gernot Frisch

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.

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.
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
 
I

Ioannis Vranos

MJL said:
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
 
I

Ioannis Vranos

MJL said:
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
 
P

Pete Becker

MJL said:
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.
 
?

=?ISO-8859-2?Q?Mateusz_=A3oskot?=

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.
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).
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
 
M

MJL

The problem with Microsoft's EVC++ platform is that it does not
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top