测试你的C技能 - 错误 [英] Test Your C Skills - Errors

查看:51
本文介绍了测试你的C技能 - 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是我为本书测试你的C />
技能所做的勘误列表的链接。由Yashwant Kanetker撰写。
http://avsharath.googlepages.com/Tes ... illsErrata.htm

如果我在那里写了任何错误,或者在那里添加任何

,请告诉我。 />
-

Sharath

Below is a link to an errata list I made for the book "Test Your C
Skills" Written by Yashwant Kanetker.
http://avsharath.googlepages.com/Tes...illsErrata.htm
Please let me know if I''ve written anything wrong there, or anything
that should be added there.
-
Sharath

推荐答案

Sharath说:
Sharath said:

下面是我为测试你的C />
技能这本书制作的勘误列表的链接。由Yashwant Kanetker撰写。
http://avsharath.googlepages.com/Tes ... illsErrata.htm

如果我在那里写错了什么,或者应该在那里添加任何

,请告诉我。
Below is a link to an errata list I made for the book "Test Your C
Skills" Written by Yashwant Kanetker.
http://avsharath.googlepages.com/Tes...illsErrata.htm
Please let me know if I''ve written anything wrong there, or anything
that should be added there.



如果您正确引用了他的Q1.0,为什么继续使用

的勘误表?很明显,这个家伙不会很好地掌握这门语言,因此可以写一本

权威书籍。


-

Richard Heathfield

Usenet是一个奇怪的地方 - dmr 29/7/1999
http://www.cpax.org.uk

电子邮件:rjh在上述域名中, - www。

If you have quoted his Q1.0 correctly, why continue with the errata at
all? Clearly the guy doesn''t know the language well enough to write an
authoritative book on it.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.


Sharath< av ******* @ gmail.com写的:
Sharath <av*******@gmail.comwrites:
http:// avsharath.googlepages.com/Tes...illsErrata.htm

如果我在那里写错了什么,请告诉我,或者任何事情

应该加在那里。
http://avsharath.googlepages.com/Tes...illsErrata.htm
Please let me know if I''ve written anything wrong there, or anything
that should be added there.



我立即注意到以下情况。您声称:


只有两种类型的范围,文件和块范围。

没有功能范围或原型范围。


这是错的。从C99开始,第6.2.1p2节:


对于标识符指定的每个不同实体,

标识符仅在内部可见(即,可以使用)一个程序文本的
区域称为其范围。由相同标识符指定的不同实体

具有不同的

范围,或者位于不同的名称空间中。有四个

^^^^^^^^^^^^^^

种范围:功能,文件,块和功能

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^ ^^

原型。 (函数原型是声明其参数类型的函数原型的声明。

^^^^^^^^^^

函数。)


很明显,你所报道的这本书有很多错误,但

我也不确定你自己的资格。你有这个C标准的
a副本吗?


我在你的网页上没有进一步阅读。

-

int main(void){char p [] =" ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuv wxyz.\

\ n",* q =" kl BIcNBFr.NKEzjwCIxNJC" ;; int i = sizeof p / 2; char * strchr(); int putchar(\

); while(* q){i + = strchr(p,* q ++) - p; if (i> =(int)sizeof p)i- = sizeof p-1; putchar(p [i] \

);} return 0;}

I noticed the following right away. You claim:

There are only two types of scopes, file and block scope.
There is no function scope or prototype scope.

This is wrong. From C99, section 6.2.1p2:

For each different entity that an identifier designates, the
identifier is visible (i.e., can be used) only within a
region of program text called its scope. Different entities
designated by the same identifier either have different
scopes, or are in different name spaces. There are four
^^^^^^^^^^^^^^
kinds of scopes: function, file, block, and function
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^
prototype. (A function prototype is a declaration of a
^^^^^^^^^^
function that declares the types of its parameters.)

Clearly, the book on which you are reporting has many errors, but
I''m not sure about your own qualifications, either. Do you have
a copy of the C standard?

I didn''t read further in your webpage than this.
--
int main(void){char p[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuv wxyz.\
\n",*q="kl BIcNBFr.NKEzjwCIxNJC";int i=sizeof p/2;char *strchr();int putchar(\
);while(*q){i+=strchr(p,*q++)-p;if(i>=(int)sizeof p)i-=sizeof p-1;putchar(p[i]\
);}return 0;}


4月20日凌晨1点10分,Sharath< avshar ... @ gmail.comwrote:
On Apr 20, 1:10 am, Sharath <avshar...@gmail.comwrote:

以下是勘误表的链接我为这本书做的名单测试你的C

技能由Yashwant Kanetker撰写。 http://avsharath.googlepages.com/Tes...illsErrata .htm

如果我在那里写了任何错误,或者在那里添加任何

,请告诉我。
Below is a link to an errata list I made for the book "Test Your C
Skills" Written by Yashwant Kanetker.http://avsharath.googlepages.com/Tes...illsErrata.htm
Please let me know if I''ve written anything wrong there, or anything
that should be added there.



不错的尝试。提到你所指的版本(假设那里

可能是多个版本:-))

关于第3点,它在ANSI C中也无效。解释一下

更多关于未定义的行为。在阅读Yashwant Kanetkar之后,您的目标受众将会被玷污。未定义的行为

并不意味着它会给出不可预测的行为,或者你的PC将会是b / b,但行为将取决于编译器和平台


最后一个问题描述非标准函数没问题,没有损害

in

Nice attempt. Mention the edition you are referring (assuming there
might have been multiple ones :-))
Regarding point #3 it is not valid in ANSI C also. Explain a little
more about undefined behavior. Your intended audience would be lay C
users corrupted after reading Yashwant Kanetkar. Undefined behavior
doesnt mean that it will give unpredictable behavior or your PC will
go berzerk but behavior will depend on the compiler and platform

Last question it is fine to describe non standard functions, no harm
in it


-

Sharath
-
Sharath



这篇关于测试你的C技能 - 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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