C编译器和C99发生了什么? [英] What's going on with C Compilers and C99??

查看:107
本文介绍了C编译器和C99发生了什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好!


什么是好用的编译器? (适用于MS Windows,适用于Linux)

任何建议?

如果有不同的编译器,那么拥有C99标准有什么意义

仍然会产生不同的结果?


标准的主要原因是(在我看来)可移动性和

一致性。

/ ************** C99资源*************** /

C99标准(委员会) 2005年草案 - ISO / IEC 9899:TC2)
http://www.open-std.org/jtc1/sc22/wg...docs/n1124.pdf


"新C标准:文化和经济评论作者:Derek M.

Jones
http://www.coding-guidelines.com/cbook/cbook1_0b.pdf

http://www.knosof.co.uk/cbook/cbook.html

这是终极C99参考圣经,因为它讨论了C99标准的每一个b / b
。哇!


但似乎没有人关心:

我最近尝试了一堆*免费*编译器......


MinGW GCC(没有C99支持,例如printf(%I64d,99999999LL)),

Lcc-Win32,

Pelles C,

Cygwin GCC


并获得相同代码片段的不同结果


/ ********** ************* /

#include< stdio.h>

#include< math.h>


int main(无效)

{

printf("%f\ n",sqrt(4.0L));

printf("%lf \ n",sqrt(4.0L));

printf("%Lf \ n",sqrt(4.0L)); // printf("%Lf \ n",(long

double)sqrt(4.0L));

返回0;

}

/ *********************** /

(可能有更好的例子,以显示编译器

的差异!


我(目前)不是C专家,当然也不是C99标准。

(我不知道C99标准是否指定了,第3个打印输出的第3个输出应该是什么......)

即使是printf我真的很沮丧(是的,那个Hello World

函数)因实现而异。

printf("%hhd%hd%d%lld",a,b ,c,d); //我想知道有多少编译器

正确支持这个(C99)...尝试MinGW :)

但是如果我使用编译器,我期待它的运作!并且有可预测的

行为!并实施C99标准!

我认为C99失败了,如果只有少数编译器支持它。

(多年生 http://www.peren.com/ 进行一致性测试,只有一小部分编译器被验证为符合C99:
http://www.peren.com/ pages / cvsa_isocvpl.htm

Sun Studio 9似乎是唯一的免费编译器,完全支持C99。
支持C99。 (哇,maby我应该学习并使用Solaris)

其余的......其他人似乎都在做自己的事情:

Microsoft Visual C ++正在做他们自己的事情。 GCC正在做他们的...所以




似乎没有人真正对遵循C99标准感兴趣。

相反,每个人都很高兴有一个编译器,可以简单地生成

代码(C99可能是一个丑陋的神秘读取)并且游戏似乎

将被播放为如下:

"忘记携带!和当下的代码!使用您正在使用的编译器调整您的代码,直到它b / b $ b。

如果需要移植,请在必要时执行。地狱,

编译器无论如何都会改变!!"

???

Maby我应该效仿:编码并测试它你的编译器,(暂时感到困惑),调试并完成了!


*************** *********>>>

顺便问一下:谁参与了C99标准?

为什么他们不邀请C编译器编写器(Visual C,GCC,Watcom)以

参与??? C99真的难以实现吗?

好​​吧,C99的商用产品怎么样?

***

啊,这里有Dinkumware( http://www.dinkumware.com/

他们有一个图书馆Dinkum Compleat可以为MS购买

Windows Visual C ++(200美元)或Linux GCC(200美元)并允许C99在

除了许多其他东西之外(你不能得到C99部分

单独)。该库可以二进制形式购买($ 200Dinkum

Compleat Libraries Binary用于Visual C ++ xor Linux GCC,或$ 400用于

)或源表格($ 2300)并符合Perennial C99标准(参见
http://www.peren.com)


***

啊,有Comeau C / C ++。 http://www.comeaucomputing.com/

什么一个丑陋的网页!丑陋地使用字体,并在
我挥舞着眨眼50美元!

似乎包含了Dinkumware库... oops no

(欺骗了我)......他们只有......来自Dinkumware ...只需200美元

所以看来我需要花费$(50 + 200)来获得Comeau C / C ++ $>
Dinkumware符合C99标准。

(Libcomo似乎是Comeau自己的C库,但我找不到

的价格 - 而且它可能不支持C99。)

啊等等,为了使用Comeau,我需要另一个编译器......什么

就是这个野兽!??? ?


对于MS窗口:例如Comeau C / C ++ &安培; Visual C ++ &安培; Dinkumware

Libraries对于C99

对于Linux:例如Comeau C / C ++ &安培; " GCC" &安培; Dinkumware Libraries for

C99


它是一个前端,它接收你的C代码(C1)并产生一个

中间形式从另一个C代码(C2)。

然后你使用另一个编译器(Visual C ++,或GCC)将C2编译为

机器代码。 />
" Comeau C / C ++"甚至没有他们自己的机器代码生成器。


我不明白为什么有人会使用Comeau ...


***

啊,爱迪生设计集团: http:// www。 edg.com/ http://www.edg。 com / index.php?location = c_frontend

这4个人有一个支持C99的前端(另见
http://www.peren.com/pages/cvsa_isocvpl.htm

英特尔'C ++编译器'的前端基于EDG,Comeau的基础是
http://www.edg.com/index.php?location=faq_q3_who

这是否意味着Comeau是符合C99? (谁知道?:
http://www.thescripts.com/ forum / thre ... 9651-1-10.html


SUIF和Zephyr也使用EDG
http://www.edg.com/index.php?location=faq_q4_other


有没有人知道SUIF(与EDG前端相匹配
http://suif.stanford.edu/~livshits/c.../clickthru.cgi )好吗?
http://www-suif.stanford.edu/suif/suif2/

是否有任何编译器建议...

现在我不愿意使用商业工具。

我想我会坚持使用GCC (以各种形式:Linux,Cygwin,

MinGW)并玩游戏,接受那个瘦gs只是不完美。

任何意见或建议,提示等将不胜感激


亲切的问候,

Albert

Hello!

What is a good compiler to use? (for MS Windows, for Linux)
Any recommendations??
What''s the point of having a C99 standard, if different compilers
still produce differing results?

The main reason for a standard, is (in my opinion) portabilty and
conformance.

/************** C99 Resources ***************/
C99 Standard(Committee Draft 2005 - ISO/IEC 9899:TC2)
http://www.open-std.org/jtc1/sc22/wg...docs/n1124.pdf

"The New C Standard: A Cultural and Economic Commentary" by Derek M.
Jones
http://www.coding-guidelines.com/cbook/cbook1_0b.pdf
(http://www.knosof.co.uk/cbook/cbook.html)
This is the ultimate C99 reference bible, since it discusses every
sentance of the C99 standard. Wow!

But no one seems to care:
I recently tried a bunch of *free* compilers...

MinGW GCC (no C99 support e.g. printf("%I64d",99999999LL)),
Lcc-Win32,
Pelles C,
Cygwin GCC

and got different results for the same code snippet

/***********************/
#include <stdio.h>
#include <math.h>

int main(void)
{
printf("%f\n", sqrt(4.0L));
printf("%lf\n", sqrt(4.0L));
printf("%Lf\n", sqrt(4.0L)); // printf("%Lf\n", (long
double)sqrt(4.0L));
return 0;
}
/***********************/
(There are probably much better examples, to show how compilers
differ!

I''m (currently) no expert in C, and certainly not on the C99 standard.
(I wonder if the C99 standard specifies, what the ouput of the 3rd
printf should be...)
I get really frustrated when even printf (yes, that "Hello World"
function) differs from implementation to implementation.
printf("%hhd %hd %d %lld", a, b, c, d); // I wonder how many compilers
support this (C99) correctly... try MinGW :)
But if I use a compiler, I expect it to work! and to have predicatable
behaviour! and to implement the C99 standard!
I think C99 has failed, if only a few compilers support it.
(Perennial http://www.peren.com/ conducts conformance tests and only a
handful of compilers are validated as C99-compliant:
http://www.peren.com/pages/cvsa_isocvpl.htm)
Sun Studio 9 seems to be the only free compiler out there, that fully
supports C99. (Wow, maby I should learn and use Solaris)
For the rest... everyone else seems to be doing their own thing:
Microsoft Visual C++ are doing theirs... GCC is doing theirs... and so
on

No one seems to be really interested in following the C99 standard.
Instead everyone is happy to have a compiler that can simply produce
code (C99 is probably an ugly cryptic read anyway) and the game seems
to be played as follows:
"Forget portability! and code for the moment! Adapt your code, till it
works, with the compiler you''re using.
If it needs to be ported, do it when it''s necessary. Hell, the
compilers will have changed anyway!!"
???
Maby I should follow suit: Code and test it with your compiler, (be
puzzled for a moment), debug and done!

************************>>>
By the way: who is involved in the C99 standard?
Why didn''t they invite C compiler writers (Visual C, GCC, Watcom) to
take part??? Is C99 really that hard to implement?
Ok, what about commercial products for C99?
***
Ah, there''s Dinkumware (http://www.dinkumware.com/)
They have a library "Dinkum Compleat" that can be bought for either MS
Windows Visual C++ ($200) or Linux GCC ($200) and allows C99 in
addition to many other things (you cannot get the C99 part
seperately). That library can be bought in binary ($200 "Dinkum
Compleat Libraries Binary" for Visual C++ xor Linux GCC, or $400 for
both) or source form ($2300) and is Perennial C99 compliant (see
http://www.peren.com).

***
Ah, there''s Comeau C/C++. http://www.comeaucomputing.com/
What an ugly web-page! Ugly use of font, and waving a blinking $50 at
me!
It seems as though Dinkumware libraries are included... oops no
(fooled me)... they are only available... from Dinkumware... for $200
So it seems I need to spend $ (50+200) for Comeau C/C++ with
Dinkumware for C99 compliance.
(Libcomo seems to be Comeau''s own C library, but I could not find a
price - and it probably doesn''t support C99.)
Ah but wait, in order to use Comeau, I need another compiler... What
is this beast!????

For MS windows: e.g. "Comeau C/C++" & "Visual C++" & "Dinkumware
Libraries" for C99
For Linux: e.g. "Comeau C/C++" & "GCC" & "Dinkumware Libraries" for
C99

OK, so "Comeau C/C++" works like this:
It is a front end that takes your C-code (C1) and generates an
"Intermediate Form" and from that another C code (C2).
Then you use another compiler (Visual C++, or GCC) to compile C2 to
"machine code".
"Comeau C/C++" don''t even have their own machine code generator.

I don''t see why anyone would use Comeau...

***
Ah, Edison Design Group: http://www.edg.com/ http://www.edg.com/index.php?location=c_frontend
These 4 guys have a front-end that supports C99 (see also
http://www.peren.com/pages/cvsa_isocvpl.htm)
Intel''s C++ compiler''s front end is based on EDG, as is Comeau''s
(http://www.edg.com/index.php?location=faq_q3_who)
Does this mean that Comeau is C99 compliant? (Who knows?:
http://www.thescripts.com/forum/thre...9651-1-10.html)

SUIF and Zephyr also use EDG
http://www.edg.com/index.php?location=faq_q4_other

Does anyone know if SUIF (with matching EDG front-end
http://suif.stanford.edu/~livshits/c.../clickthru.cgi) is good?
http://www-suif.stanford.edu/suif/suif2/
Are there any compiler recommendations...
Right now I''m unwilling to use commercial tools.
I think I''ll just stick with GCC (in its various forms: Linux, Cygwin,
MinGW) and play the game, accepting that things just aren''t perfect.
Any comments or recommendations, tips etc. will be appreciated

Kind regards,
Albert

推荐答案

200)或Linux GCC(
200) or Linux GCC (


200)并允许C99进入

除了许多其他东西(你不能单独获得C99部分

)。该库可以二进制形式购买(
200) and allows C99 in
addition to many other things (you cannot get the C99 part
seperately). That library can be bought in binary (


200Dinkum

Compleat Libraries Binary用于Visual C ++ xor Linux GCC,或
200 "Dinkum
Compleat Libraries Binary" for Visual C++ xor Linux GCC, or


这篇关于C编译器和C99发生了什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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