C便携性是一个神话 [英] C portability is a myth

查看:53
本文介绍了C便携性是一个神话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚阅读了关于这个小组的几篇文章,它让我感到非常惊讶

可移植性被用作语言清洁的有力论据。


在我的意见,移植程序(所以你只需要获取源代码和

重新编译)是一个神话,开始于20 - 30年前,当时世界包括

UNIX系统。好吧,世界不再包含UNIX系统了,但是

有100多种不同的系统在手机,DVD播放器,

游戏机等中运行。所有这些平台上工作的极少数程序是:loop:goto loop;。


另一点是真实的编译器几乎从不遵守

标准。因此,即使将代码从一个编译器转移到另一个编译器并且

重新编译也是一个神话,除非我们谈论一些真正简单的一个晚上

类型的应用程序。


最后但并非最不重要的一点是可移植性的合理性。

假设我使用所有可能的编译器扩展在500小时内编写应用程序。

有理由把它写成完美的portale并花费1500小时

代替?在我看来不是,因为我可以在另外500小时内从头开始写它/ b $ b或稍微玩一下它可能会把它调整到

第二平台或不同的编译器方式更快。


老实说......平均移植你的程序有多少不同的平台和/或编译器?



请在开始发送火焰之前,请将小组

介绍到您在平台之间移植软件的最后一个项目。并且

让它不是Win98 - > WinXp ......

I just read couple articles on this group and it keeps amazing me how
the portability is used as strong argument for language cleanliness.

In my opinion, porting the program (so you just take the source code and
recompile) is a myth started 20-30 years ago when world consisted of
UNIX systems. Well, world does not consist of UNIX systems anymore, but
there are 100s of different systems running in cell-phones, DVD players,
game consoles etc. And one of the very few programs which would work on
all these platforms is: "loop: goto loop;".

Another point is that real worls compilers almost never comply to the
standards. So even taking the code from one compiler to another and
recompiling is a myth unless we talk about some real simple one-evening
type of apps.

And the last but not least point is the justification of portability.
Say I write app in 500 hours using all possible compiler extensions.
Does it justify to write it perfectly portale and spend 1500 hours
instead ? In my eyes not, because I can probably write it from scratch
in another 500 hours or play with it a little and probably adjust it to
second platform or different compiler way faster.

To be honest ... to how many different plattforms and/or compilers are
you porting your programs in average ?

And please, before you start sending flames, please introduce the group
into your last project of porting the software between platforms. And
let it not be Win98 -> WinXp ...

推荐答案

所以我不仅批评:


我最近的迷你之一-projects必须在Win / PC上开发并且

重新编译并在PocketPC上工作。 ARM不喜欢使用未对齐的

字,而Pentium和我使用竞技场分配分配

性能原因。所需要的只是将竞技场分配

结构与32位对齐...


我想这里的任何人都可以讲述关于字节的故事......


roman ziak写道:
roman ziak wrote:
所以我不仅批评:

我最近的一个迷你必须在Win / PC上开发项目并重新编译并在PocketPC上工作。 ARM不喜欢使用未对齐的单词和Pentium一样使用竞技场分配来分配性能原因。所需要的只是将竞技场分配的结构与32位对齐...

我想这里的任何人都可以讲述关于字节的故事......
And so I am not only critisizing:

One of my recent mini-projects had to be developed on Win/PC and
recompile and work on PocketPC. ARM does not like to work with unaligned
words as much as Pentium and I used arena allocation for allocation
performance reasons. All it needed was to align arena allocated
structures to 32 bit ...

I guess anybody here can tell stories about endianity ...



Netbsd。用C语言编写,有超过50种架构,并且有设备驱动程序

独立于架构。


C是一个相对较低级别的语言。如果您不了解架构

&然后它就是你的问题。


gtoomey



Netbsd. written in C, runs of over 50 architectures and has device drivers
independent of architecture.

C is a relatively low level lamnguage. If you don''t understand architectures
& alignment then its your problem.

gtoomey


http://www.netbsd.org/People/developers.html


他们忘了包括你在内?


在其他人走路的时候很容易说话。
http://www.netbsd.org/People/developers.html

Did they forget to include you ?

It''s easy to talk while others walk.


这篇关于C便携性是一个神话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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