最后一个网站上有所有的C基金会 [英] Finally one site with all the C fundas

查看:96
本文介绍了最后一个网站上有所有的C基金会的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

http:/ /concentratedlemonjuice.blogsp...n-my-blog.html

我现在正在寻找更多关于C的工作,今天有

许多网站将为您提供大学级别的理解

指针,但是在软件项目中你需要时间来b / b
继续并决定使用一些你从来没有使用过的C ++特性


你从未见过的一些C基础,它增加了清洁度

代码并帮助其他人提高他们的标准。

我相信这个政策,当你编写好的代码时,你会额外增加一个额外的帮助他人获得更好的编码技巧stoo

http://concentratedlemonjuice.blogsp...n-my-blog.html

I actually am searching for more work done on C now, today there are
many sites that will provide you college level understanding of
pointers, buta time comes when in a software project you will have to
go ahead and decide about using some feature of C++ that you never
used

some funda of C that you never saw ,and it adds to the cleanliness of
code and helps others improve their standards too.
I believe in this policy that when you write good code, you go one
step extra in helping others achieve better coding skill stoo

推荐答案

pa ***** ***@hotmail.com 说:

>
>

http://concentratedlemonjuice.blogsp...n-my-blog.html

不要打扰,伙计们 - 这是通常的混蛋神话,错误和

偶然(偶然?)正确性。


-

Richard Heathfield< http:/ /www.cpax.org.uk>

电子邮件:-http:// www。 + rjh @

谷歌用户:< http://www.cpax.org.uk/prg/writings/googly.php>

Usenet是一个奇怪的放置" - dmr 1999年7月29日

http://concentratedlemonjuice.blogsp...n-my-blog.html

Don''t bother, folks - it''s the usual mishmash of myth, error, and
occasional (accidental?) correctness.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999


pa ******* *@hotmail.com < pa ******** @ hotmail.comwrote:
pa********@hotmail.com <pa********@hotmail.comwrote:
http://concentratedlemonjuice.blogsp...n-my-blog.html


我现在正在寻找更多关于C的工作,今天有很多网站可以为你提供大学水平的理解

指针,但是在软件项目中你需要时间来b / b
继续并决定使用C ++的某些功能,你永远不会这么做$ b使用
I actually am searching for more work done on C now, today there are
many sites that will provide you college level understanding of
pointers, buta time comes when in a software project you will have to
go ahead and decide about using some feature of C++ that you never
used



对不起,如果你想发布(相当琐碎)C谜题

你首先要注意C和之间的区别C ++。

大多数所谓的C-puzzle实际上都是C ++(我不能

j如果在这些情况下答案是正确的话,请使用。 C和C ++

是不同的语言。接下来你应该纠正一些错误的错误。例如


2:这个宏有什么问题可以找出

平方的数字


#定义正方形(a)a * a


答案:

如果将表达式传递给此宏,则会失败。

例如:square(2 + 3)将扩展为2 + 3 * 2 + 3 = 11

而实际结果应为25

为了解决这个问题你可以把宏写成

#define square(a)((a)*(a))


正确答案当然是这个宏不能

安全日常使用,即使有额外的括号,

因为例如''square(i ++)''仍将导致表达式

调用未定义的行为..





5.声明是1& 2对,如果我们声明str如下?


char * const str =" Hello" ;;


1. * str =' 'W'';

2. str =" World";


答案:

1-right

2-wrong


1和2都不是有效的作业。第一个不是因为

你不允许更改字符串文字(即使你在某些系统上可以贬低
)。


BYW,如果在#4中你在前面省略了''const''

const char * abcd =" Test" ;


你仍然不被允许这样做


* abcd =''H'';


出于完全相同的原因。




6.以下代码有什么问题


typedef struct A {

int i;

};


A * RetStruct()

{

A a;

ai = 10;

return& a;

}


甚至不会编译,因为在任何地方都没有定义类型''A'。

编译器可能会抱怨第3行的'';''。


这些是6个中的3个谜题。那可能是C,剩下的就是我所能看到的所有

C ++。

问候,Jens

-

\ Jens Thoms Toerring ___ jt@toerring.de

\ __________________________ http://toerring.de


关于主题最后一个具有所有C基金的网站,一点点谷歌搜索表示基础是源自印度英语的基本,

的缩写。我以前从未见过它。如果你想在印度以外的读者理解,那么
会建议避免使用该术语。

jt@toerring.de (Jens Thoms Toerring)写道:
Regarding the subject "Finally one site with all the C fundas", a bit
of Googling indicates that "funda" is a contraction of "fundamental",
origininating in Indian English. I''ve never encountered it before. I
would suggest avoiding the term if you want to be understood by
readers outside India.

jt@toerring.de (Jens Thoms Toerring) writes:
pa ******** @ hotmail.com < pa ******** @ hotmail.comwrote:
pa********@hotmail.com <pa********@hotmail.comwrote:

> http://concentratedlemonjuice.blogsp...n-my-blog.html



[...]

[...]


2:这个宏有什么问题找出

平方的数字


#define square(a) a * a


答案:

如果你将表达式传递给这个宏,它就会失败。

例如:square(2 +3)将扩展为2 + 3 * 2 + 3 = 11

而实际结果应该是25

为了解决这个问题你可以把宏写成

#define square(a)((a)*(a))


当然,正确的答案是,即使有额外的括号,这个宏也不能为日常使用安全保证,

,因为例如''square(i ++)''仍将导致表达式

调用未定义的行为..
2: What is wrong with this macro to find out the
square of a number

#define square(a) a*a

ANSWER:
If you pass an expression to this macro, it fails.
Eg: square(2+3) will be expanded to 2+3*2+3 = 11
whereas the actual result should be 25
Inorder to solve this problem you can write the macro as
#define square(a) ((a)*(a))

The correct answer is, of course, that this macro can''t be
made safe for everyday use, even with the extra parentheses,
since e.g. ''square(i++)'' will still result in an expression
invoking undefined behaviour..



此外,语句如果你将一个表达式传递给这个宏,那么

就会失败是不正确的,或至少是不完整的。我可以将

表达式(2 + 3)传递给宏:square((2 + 3)),它工作得很好。


答案部分解释了围绕

参数的内括号,但没有围绕整个定义的外括号。


宏的另一个问题是它的名称。按照惯例,宏通常会给出所有大写字母名称,以警告读者可能存在多种副作用。

可能性。这个:


#define SQUARE(a)((a)*(a))


将是无可非议的。它确实有问题Jens指出,

参数的任何副作用都会发生两次,但使用

all-caps名称警告知识渊博的用户以避免调用就这样。

Also, the statement that "If you pass an expression to this macro, it
fails" is incorrect, or at least incomplete. I can pass the
expression (2+3) to the macro: square((2+3)), and it works just fine.

The answer section explains the inner parentheses around the
arguments, but not the outer parentheses around the whole definition.

The other problem with the macro is its name. By convention, macros
are usually given all-caps names, to warn the reader about the
possibility of, for example, multiple side-effects. This:

#define SQUARE(a) ((a)*(a))

would be unobjectionable. It does have the problem Jens points out,
that any side effects of the argument will occur twice, but using an
all-caps name warns a knowledgeable user to avoid calling it that way.



Or



[snip]

[snip]


>




6.以下代码有什么问题


typedef struct A {

int i;

};


A * RetStruct()

{

A a;

ai = 10;

返回& a;

} <由于在任何地方都没有定义A类型,因此
甚至不会编译。

编译器可能会抱怨'';''第3行。


这些是6个谜题中的3个。可能是C,剩下的就是我所能看到的全部。
>
Or

6. What is the problem with the following piece of code

typedef struct A{
int i;
};

A* RetStruct()
{
A a;
a.i=10;
return &a;
}

won''t even compile since there is no type ''A'' defined anywhere.
The compiler probably will complain about the '';'' on line 3.

These are 3 out of 6 "puzzles" that could be C, the rest is all
C++ as far as I can see.



据推测,#6是C ++。


另一个问题,无论它的目的是什么,都是它's
没有缩进。 (而且网页上的黑色背景上的白色文字

网站非常烦人,至少对我而言。)


-

Keith Thompson(The_Other_Keith) ks***@mib.org < http://www.ghoti.net/~ kst>

诺基亚

"我们必须做点什么。这是事情。因此,我们必须这样做。

- Antony Jay和Jonathan Lynn,是部长

Presumably #6 is C++.

Another problem, whichever language it''s intended to be, is that it''s
not indented. (And the white text on a black background on the web
site is extremely annoying, at least to me.)

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"


这篇关于最后一个网站上有所有的C基金会的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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