可移植性问题 [英] portability issues

查看:96
本文介绍了可移植性问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在试图弄清楚如何使我的代码尽可能便携。

我真的不太使用STL。我可以使用链接的

字符串列表。 Microsoft确实提供了一个对象列表和一个字符串

列表类,但是当我使用Borland或

其他环境时我必须重写我的代码。


另一个问题是GUI。我知道最好将

功能代码与可视化界面代码分开,但是在移植到另一个平台时仍然需要做很多工作。也许GUI

概念被高估了,并且可以用于

工作场所中必须具有功能但不漂亮的程序。


因此,为了最具可移植性,我将编写一个字符串类链接列表

并尽量减少GUI组件的使用。还有其他想法吗?


我不打算:


1)切换到Java。

2)购买一个图书馆来补充一个不足之处。


也许偶尔会重新发明轮子。

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写道:
我试图找出如何使我的代码尽可能便携。
我并没有真正使用很多STL。


STL曾经是便携式的东西,你应该使用它。


我可以通过链接的字符串列表获得。 Microsoft确实提供了一个对象列表和一个字符串列表类,但是在使用Borland或其他环境时我必须重写我的代码。


如果使用std :: string和std :: list则不然如此!

另一个问题是GUI。我知道最好将功能代码与可视化界面代码分开,但在移植到另一个平台时仍然需要做很多工作。也许GUI
概念被高估了,并且可以用于工作场所中必须具有功能但不漂亮的程序。


看看一些GUI库,例如: wxwindows。

因此,为了最便携,我将编写一个字符串类的链接列表
并尽量减少GUI组件的使用。还有其他想法吗?

我不打算:

1)切换到Java。
2)购买一个库以补充一个库。
偶尔重新发明轮子也许是值得的。
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.




那里有很多轮子的副本。


ma**@affordablemedicalsoftware.com (MJL)在留言新闻中写道:< 29 **************************@posting.google。 com> ...
ma**@affordablemedicalsoftware.com (MJL) wrote in message news:<29**************************@posting.google. com>...
我试图弄清楚如何使我的代码尽可能便携。
我并没有真正使用很多STL。我可以使用链接的字符串列表。 Microsoft确实提供了一个对象列表和一个字符串
列表类,但是在使用Borland或其他环境时我必须重写我的代码。
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.




对困惑感到抱歉。在编辑我的帖子时,我必须意外删除

第一行或第二行。我最喜欢的平台之一是用于编写支持
的Microsoft Pocket PC。我使用嵌入式Visual C ++因为它是免费的b $ b,我不想学习Visual Basic,这是PPC的另一个选择

。我真正喜欢EVC ++的是我可以编译一个

的可执行文件,可以通过红外线或存储卡放在设备上

并且无需通过台式机安装即可运行。


微软EVC ++平台的问题在于它没有包括STL在内的
。当然,VC ++的桌面版和Borland'的
C ++ Builder以及其他所有编译器都包含它。这就产生了

的情况,如果我在桌面程序中使用STL代码,我必须为我的掌上电脑版本重写它.b / b


我同意更好的解决方案是微软不要遗漏

标准C ++的重要功能。我希望其他手持设备能够安装其他更好的操作系统。一个新的苹果牛顿将是理想的,如果他们尽可能接近OS X.



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.


On 8/2/2004 5: 05 AM,MJL写道:
On 8/2/2004 5:05 AM, MJL wrote:
我使用嵌入式Visual C ++是因为它是免费的,我不想学习Visual Basic,这是PPC的另一个选择。


第三个是使用.NET CF和C#或VB .NET但

我不推荐它用于Pocket PC,只是C ++是最好的。

Personaly,我不喜欢.NET ;-)

微软EVC ++平台的问题在于它没有
包括STL。


错了! Pocket PC 2002的SDK不包括STL,

但是Pocket PC 2003的SDK可以。简单地说,安装eVC ++ 4.0。

我主要使用eVC ++ 4.0因为它更好,更符合C ++标准符合
并且只有PPC 2003在市场上销售,但是/>
这是另一个故事。


我使用由Giuseppe Govi移植的STL:

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


它在eVC ++ 3.0和eVC ++ 4.0中也很棒。

我强烈推荐这个STL端口。

这就创造了
情况,如果我在桌面程序中使用STL代码,我必须为我的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 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.




不,你不必重写它。

在我的公司,我们使用

STL开发了GIS组件(不是COM / ActiveX),它在桌面Windows和UNIX / Linux上编译

没有任何变化。


因此,为了更好地符合C ++标准我使用

Entr用于RTTI和C ++异常处理的ek补丁。

我根本不使用结构化异常处理(SEH)。


Greets
< br $>
-


Mateusz£oskot

mateusz at loskot dot net



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


这篇关于可移植性问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆