C++ criticized/defensed (cont'd)

ajoo 2002-06-11 11:33:31
reached the 30 posts limit. So we can talk here.
huwx:
compared to gj, template is more like macro. It is just an advanced macro.
generics have nothing to do with single inheritance. no relationship, no contradiction.
What generics is for? type safety. That's it. template has meta-programming, but gj does not. template has code-bloating, gj does not.

copy&paste my question here again for discussion:

give an example of sizeof:
I had a discussion with a C++ guy on mit bbs.
I would say his C++ knowledge is well beyond average level. He knows pretty much about meta-programming.
He raised a question for one problem:

need to implement a template based class, in which we need the following method
void add(T val);

What he's puzzled is that he does not know what the T is and he wanted his code as efficient as possible.

He's concerned about the overhead of copying in pass-by-value,
While, he's not too happy about the extra address indirection of pass-by-ref either.

So, he's got a plot.

Define a size limit, for type T that sizeof(T)>limit, use const T& for the add method.
for other types, use T for the add method.

How do you guys think about his design? Is it scalable? Is it cross-platform? Should he forget about "programming"?

...全文
150 79 打赏 收藏 转发到动态 举报
写回复
用AI写文章
79 条回复
切换为时间正序
请发表友善的回复…
发表回复
cloudwu 2002-06-14
  • 打赏
  • 举报
回复
http://www.microsoft.com/msdownload/iebuild/ime5_win32/en/ime5_win32.htm

这里可以当到中文支持. btw, 我用的 EWin2K, 98 不知可不可以.


那个宏的诞生是因为我的那个平台上没有 C++, 也不能直接用汇编.
而需要做一些好象模板特例化的工作, 只好用宏来模拟
(N>0)?(a):(b) 这样的代码, C 一般不给你优化的很好的, 即使 N 是常数.
但是 (N>0) && (a) || (N<=0) && (b) 却可以.
因为 C 标准里定义了它的逻辑表达式运算规则.

而且表达式写成一行, 跟多行写优化的效率也不一样.

所以有了那种宏的出现. 当一段代码需要 50 个周期还是 45 个周期
很重要时, 这些宏技巧就可以带来好处了.

而且更多的时候, 我喜欢把宏当玩具玩, 而不是解决实际问题 :)

在很多情况下, 为了效率, 我禁止掉对象的复制. 但是需要对象的传递.
比如有一个Object a, 我希望它可以传递给 Object b.
比如写 Object b=a, 但是 a 不会再被使用.

这在诸如 vector<Object> 的实现中就很有用, 容器体积增长的时候,
现在需要大量的对象复制, 很多情况下, 传递比复制的开销小.
而且有的对象实现 copy 安全很困难, 但是实现传递安全却很容易.

又比如, 我在函数里生成了一个 string, 想把 string 做返回值的时候
也需要复制一份. 但是很多情况, 我需要的只是把 string 传递出去.

现在最多只能使用 cow 来减少数据copy, 但减少不了引用计数变量
本身的增减变化.

在我自己上个项目中, 我用 template 定义出一个传递语义的函数,
来干这种事情, 然后自己实现 vector 这样的容器来管理我的对象,
并把自己的对象的 operator= 这样的操作再禁止掉.

不过这样很不舒服 ;(
ajoo 2002-06-14
  • 打赏
  • 举报
回复
Hey, cloudwu, do you know of any chinese platform that I can download and use on my EWin98?
Highly appreciate it!

no offsense, but I don't like your "_if" macro, although I'm also a macro lover. I would never use macro when I can avoid code duplicating using template or function.

"我对 C++ 比较痛恨的是只有复制的语义,而没有一种反应对象传递的语义"
don't quite understand. could you be more specific?
auto_ptr has its own semantics, it does not seem to be c++'s fault ah!
cloudwu 2002-06-14
  • 打赏
  • 举报
回复
;( 如果大家用中文写多好 (或许不可能的)
欺负我可怜的英文水平, 就认得那么几个单词.

ps. 我爱死宏了. 有时候极端需要速度, 又不能用汇编的时候.
定义出这样的东西
#define _if (
#define _elseif )) || (
#define _else )) ||
#define _endif ))
#define _then && (

把老长的语句写在一行表达式里, 让编译器来优化, 感觉相当不错 :)

我对 C++ 比较痛恨的是只有复制的语义,而没有一种反应对象传递的语义,
导致 auto_ptr 这种的东西放不到stl 的容器里.
只能用COW, 通过引用计数来表达对象的复制. 这在某些情况下,
还是效率所不能接受的.
ajoo 2002-06-14
  • 打赏
  • 举报
回复
prototype:
don't want to argue about the liabilities. the fact is, code written in C++ is not easy to port, that's why I said "C++ is not cross-platform even on source code level".
but code in Java does not have the problem at all.
magic number? whatever you call it. but if he wants to tune the size limit, what else can he use?

cloudwu: don't quite understand your app. But anyway, i don't think compiler would be that smartly stupid. :) (I mean, it's hard to be that stupid)

btw, when you use VC's view assembly code in VC, you are looking at debug version, not quite useful to see the optimizations.
cloudwu 2002-06-14
  • 打赏
  • 举报
回复
为什么编译器会在那些地方优化程度不一样, 我明白, 但是讲不清楚.
如果你多看看代码编译的目标代码, 慢慢也能明白.
VC 做的优化够好了, 但是在这里依然目标代码有差别.
理论上代码是等价的, 但是理论和实际总是有差别.

至于我曾经处理的那个问题, 所以不用指针, 也有它的道理.
因为对象中数据和状态是分开的. 状态信息是 POD 的, 数据是可以共享
一片内存的. 我需要共享那片数据区, 但是有自己的状态值.
对数据区又不需要采用引用计数来管理, 因为共享数据区的对象间
本身有主次之分, 永远是主对象来分配和释放这块数据区.
等重要的是, 程序运行时有大量的构造和析构,new 和 delete 操作,
如果将对象中 POD 的分离出来, 可以加快很多速度.
比如可以专门开一个堆, 重写 new 函数后, 在这个专有的堆上按栈的方式
分配, 而永远不释放. 等到整个一组对象的使命完成, 再一次把整个堆
拿掉. 这样节省了大量的时间.

这是我好几年前做的一个东西, 那个时候对 C++ 的理解远不如现在深刻.
现在再设计可能是另外一个样子.
我想说明的是, 有时候, 牺牲一些严谨和代码重用性, 采取一些比较
糟糕和晦涩的设计, 能够带来很高的效率 :) 当效率非常的重要的时候,
这样做是有价值的.
prototype 2002-06-14
  • 打赏
  • 举报
回复
your word raises a very good point. hmmmm... the guy's code
will still not be portable. but note it originates from its
design -- branching on some agents that is completely out
of control, not the language features.
btw, the '4' in '4*sizeof' is a magic number. :-)
ajoo 2002-06-14
  • 打赏
  • 举报
回复
also, cloudwu, why don't use pointer? no overhead at all.
ajoo 2002-06-14
  • 打赏
  • 举报
回复
prototype:
Oops! misunderstanding. :)
you are sure struct{char c;} will never be smaller than int?

and normally, he wouldn't just use sizeof(int), maybe something like "4*sizeof(int)", do you think so?

cloudwu(云风) :
don't think compiler can be that stupid. "," and ";" won't make any difference in the transformed intermediate code.
?: won't be of any differnece with if-else in the intermediate code either.

even if compiler wants to make differnce, it would still be hard because it's optimizing the intermediate code, not the source code.
prototype 2002-06-14
  • 打赏
  • 举报
回复
faint. ajoo, i am suprised you don't know the meaning of
magic number, since it is such a commonly-used word in
programmers' world. magic number means an explicit number
that you know nothing about it except that you know it is
a number, it won't change unless you modify that piece of
code. magic numbers hurt r&m and make the code rigid.
example:
i = 63; // here '63' is a magic number. if you are not the
author, you don't know why it is '63', what '63' means here.
all you can probably say is something like: well, '63'
somehow "magically" makes the code work.
that (hopefully) shows the basic idea. some improved versions
of magic number include adding a comment and replacing the
number with a macro.

go back to your example in your first post, the portability
problem will not exist if he does it like this:

if sizeof(T) > sizeof(int), use pass-by-ref
else use pass-by-value

will that cause any difference in semantics on different
platforms?

cloudwu 2002-06-14
  • 打赏
  • 举报
回复
shared_ptr 内部是引用计数来实现的, 在我很在意增减计数的消耗时,
这不能接受. 这也正是我曾经做过的一个东西非常在意的地方.
当我用传递的语义实现时, (当然同时还特别做了特别的内存分配
等等配合的代码) 整个程序的速度提高了一倍多.

同时为了效率, 我还特别要区分另外一种拷贝. 就是复本肯定比原始对象
先释放. 就是对象复制出去, 但是只由自己本身来维护生命期.
比如 Object a 拥有一些内部数据, 他复制给 b (Object b=a) 的时候,
一部分数据仅仅需要复制指针就够了. a 的副本 b 实际是一个 POD 的类型.

当我有这些特殊的要求 (其实都是因为效率) 使用 C++ 本身的 STL
就不能满足要求, 还要自己再写很多东西, 这很让人苦恼 :(

关于上面提到的优化. 公认的优化做的很好的 VC
也没能把 ? : 优化到 && || && 的水平, 这点可以查看 asm 代码.

至于第2点. 写个简单的例子
struct { int a,b } f;
f.a=1,f.b=2;

和 f.a=1; f.b=2;
你认为优化结果是一样的吗? 不一样. (这个例子过于简单, 可能我的结论
并不正确, 但是简单的用 , 取代 ; 的确在很多时候能加速速度)
一般编译器是以语句段来优化的, 然后在在语句段间来合并一些不必要的操作

就我的经验来说, 编译器在一条语句内做的优化是最好的. 而合并两条语句
要差一些.

当然, 在几个时钟周期的差别并无伤大雅的时候, 还是少写晦涩的长语句的好


cloudwu 2002-06-14
  • 打赏
  • 举报
回复
我也认为我应该是错的. 不过曾经的确见过编译器干一些愚蠢的事情.
或许是看错 ;)
另外, 同样是 VC, 当编译 .c 和 .cpp 时, 优化的结果也不太相同.
简单的把 .c 改名为 .cpp 时, 似乎能优化的更好一些.
当然我指的同样是 release version.
ajoo 2002-06-14
  • 打赏
  • 举报
回复
Thanks, I'll try.
don't think compiler cannot optimize (N>0)?(a):(b) , too stupid bah?

"而且表达式写成一行, 跟多行写优化的效率也不一样"?????
don't understand.

I do like your concern about the overhead of copying. that's always a heachache in C++.
But for vector, why don't you just use ref, pointer, shared_ptr?


prototype:
it won't be so easy for me to find a number that happens to cause pass-by-ref/pass-by-val diff for a given T on two given platforms. I don't disagree.
but when I say magic number, it's a number that you choose which will NEVER cause such problem for ANY T and ANY platform.
is that magic enough? :)
prototype 2002-06-14
  • 打赏
  • 举报
回复
faint. you read my post again, ajoo. i am against using magic numbers... you totally misunderstood me...
prototype 2002-06-13
  • 打赏
  • 举报
回复
> 我认为 "my be pass-by-ref on one platform, while pass-by-val on
> another one? " 并不是问题.

no, if it was so, depending on the actual type of the object, it could be very troublesome, because you have completely different semantics here.
ajoo 2002-06-13
  • 打赏
  • 举报
回复
Oh? why? protected is bad? what does he propose? base class, subclass do have tight coupling, that's not the fault of "protected" yah.
cloudwu 2002-06-13
  • 打赏
  • 举报
回复
刚才刚起床, 没仔细看帖子的前面部分 :) (而且英文水平现在还赶不上一
中学生 ;)

我那段代码并不是实用的, 我一次也没在项目里用过, 只是当初学习时, 练手用的. 如果实用可能需要更多的考虑, 但是在解决 type size 问题上, 应该没有错.


我认为
"my be pass-by-ref on one platform, while pass-by-val on another one? "
并不是问题. 从对象的角度讲, 内部是值还是引用并不重要.
接口在所有平台上是统一的就够了, C++ 就不是 2 进制可移植的.


prototype 2002-06-13
  • 打赏
  • 举报
回复
afaics, no, unless he used magic numbers (i don't think he would if he is experienced). then it is the magic numbers, not 'sizeof', that cause nonportability.
huxw 2002-06-13
  • 打赏
  • 举报
回复
原来是酱紫,放弃了好像也不是什么大不了的事情哦。呵呵

关于trick,我的意见是,自己不写;别人写好的我就用。 ;))
一种语言,背负了太多历史包袱的时候,他就会在新特性的选取上非常谨慎(我还记得b.s.把protected引入C++看作是设计中非常失败的地方)。所以语言不足的地方,用库来不足,是有C++特色的社会主义。
huxw 2002-06-13
  • 打赏
  • 举报
回复
哦?让我不明白的是酱紫

请看is_class.hpp中的第33行,给了一个地址是吧,是google上新闻组的存档。从这个地址我们可以看到一个讨论is_enum的线索。如果看过这个线索的前几片帖子,就会看到有人提到C++标准14.8.2节的内容,如果你恰好有C++标准的话,你就可以翻到那一页,然后确认一下。我确认过了,你呢?

既然is_class是符合标准的实现,那么is_enum就是符合标准的实现,是吧 ;)
ajoo 2002-06-13
  • 打赏
  • 举报
回复
这是什么典故?
go to that C++ death thread. search for "give up programing".

水果刀? with gj, although you don't have meta-programming, specialization, you can do everything else. And much neater.
Actually, I feel that mp and specialization are something specific to C++. They could make your code quite messy. you don't need them in Java.
prototype:
I agree with you. Actually I feel some of the template tricks are just patches made by the smart programmers. without language support, traits can never be perfect.

加载更多回复(59)
这是复习及备战六级的秘籍,很赞的资源哦2008年6月大学英语六级A卷真题 Part I Writing (30 minutes) Will E-books Replace Traditional Books? 1.随着信息技术的发展,电子图书越来越多; 2.有人认为电子图书将会取代传统图书,理由是… 3.我的看法。 Part Ⅱ Reading Comprehension(Skimming and Scanning)(15 minutes) What Will the World Be Like in Fifty Years? This week some top scientists, including Nobel Prize winners, gave their vision of how the world will look in 2056, from gas-powered cars to extraordinary health advances, John Ingham reports on what the world’s finest minds believe our futures will be. For those of us lucky enough to live that long, 2056 will be a world of almost perpetual youth, where obesity is a remote memory and robots become our companions. We will be rubbing shoulders with aliens and colonising outer space. Better still, our descendants might at last live in a world at peace with itself. The prediction is that we will have found a source of inexhaustible, safe, green energy, and that science will have killed off religion. If they are right we will have removed two of the main causes of war-our dependence on oil and religious prejudice. Will we really, as today’s scientists claim, be able to live for ever or at least cheat the ageing process so that the average person lives to 150? Of course, all these predictions come with a scientific health warning. Harvard professor Steven Pinker says: “This is an invitation to look foolish, as with the predictions of domed cities and nuclear-powered vacuum cleaners that were made 50 year ago.” Living longer Anthony Atala, director of the Wake Forest Institute in North Carolina, believes failing organs will be repaired by injecting cells into the body. They will naturally go straight to the injury and help heal it. A system of injections without needles could also slow the ageing process by using the same process to “tune” cells. Bruce Lahn, professor of human genetics at the University of Chicago, anticipates the ability to produce “unlimited supplies” of transplantable human organs without the need for human donors. These organs would be grown in animals such as pigs. When a patient needed a new organ, such as a kidney, the surgeon would contact a commercial organ producer, give him the patient’s immunological profile and would then be sent a kidney with the correct tissue type. These organs would be entirely composed of human cells, grown by introducing them into animal hosts, and allowing them to develop into an organ in place of the animal’s own. But Prof. Lahn believes that farmed brains would be “off limits”. He says: “Very few people would want to have their brains replaced by someone else’s and we probably don’t want to put a human brain in an animal body.” Richard Miller, a professor at the University of Michigan, thinks scientist could develop “authentic anti-ageing drugs” by working out how cells in larger animals such as whales and human resist many forms of injuries. He says: “It is now routine, in laboratory mammals, to extend lifespan by about 40%. Turning on the same protective systems in people should, by 2056, create the first class of 100-year-olds who are as vigorous and productive as today’s people in their 60s” Aliens Colin Pillinger, professor of planetary sciences at the Open University, says: I fancy that at least we will be able to show that life did start to evolve on Mars well as Earth.” Within 50years he hopes scientists will prove that alien life came here in Martian meteorites(陨石). Chris McKay, a planetary scientist at NASA’s Ames Research Center. believes that in 50 years we may find evidence of alien life in the ancient permanent frost of Mars or on other planers. He adds: There is even a chance we will find alien life forms here on Earth. It might be as different as English is to Chinese. Princeton professor Freeman Dyson thinks it “likely” that life form outer space will be discovered before 2056 because the tools for finding it, such as optical and radio detection and data processing, are improving. He says: “As soon as the first evidence is found, we will know what to look for and additional discoveries are likely to follow quickly. Such discoveries are likely to have revolutionary consequences for biology, astronomy and philosophy. They may also change the way we look at ourselves and our place in the universe.” Colonies in space Richard Gott, professor of astrophysics at Princeton, hopes man will set up a self-sufficient colony on Mars, which would be a “life insurance policy against whatever catastrophes, natural or otherwise, might occur on Earth. “The real space race is whether we will colonise off Earth on to other worlds before money for the space programme runs out.” Spinal injuries Ellen Heber-Katz, a professor at the Wistar Institute in Philadelphia, foresees cures for injuries causing paralysis such as the one that afflicted Superman star Christopher Reeve. She says: “I believe that the day is not far off when we will be able to prescribe drugs that cause severed (断裂的) spinal cords to heal, hearts to regenerate and lost limbs to regrow.” “People will come to expect that injured or diseased organs are meant to be repaired from within, in much the same way that we fix an appliance or automobile: by replacing the damaged part with a manufacturer-certified new part.” She predicts that within 5 to 10 years fingers and toes will be regrown and limbs will start to be regrown a few years later. Repairs to the nervous system will start with optic nerves and, in time, the spinal cord.” Within 50 years whole body replacement will be routine,” Prof. Heber-Katz adds. Obesity Sydney Brenner, senior distinguished fellow of the Crick-Jacobs Center in California, won the 2002 Nobel Prize for Medicine and says that if there is a global disaster some humans will survive-and evolution will favour small people with bodies large enough to support the required amount of brain power.” Obesity,” he says.” will have been solved.” Robots Rodney Brooks, professor of robotics at MIT, says the problems of developing artificial intelligence for robots will be at least partly overcome. As a result, “the possibilities for robots working with people will open up immensely” Energy Bill Joy, green technology expert in California, says:” The most significant breakthrough would be to have an inexhaustible source of safe, green energy that is substantially cheaper than any existing energy source.” Ideally, such a source would be safe in that it could not be made into weapons and would not make hazardous or toxic waste or carbon dioxide, the main greenhouse gas blamed for global warming. Society Geoffrey Miller, evolutionary psychologist at the University of New Mexico, says: The US will follow the UK in realizing that religion is not a prerequisite (前提)for ordinary human decency. “This, science will kill religion-not by reason challenging faith but by offering a more practical, universal and rewarding moral framework for human interaction.” He also predicts that “absurdly wasteful” displays of wealth will become unfashionable while the importance of close-knit communities and families will become clearer. These three changer, he says, will help make us all” brighter, wiser, happier and kinder”. 1.What is john lngham’s report about? A) A solution to the global energy crisis B) Extraordinary advances in technology. C) The latest developments of medical science D) Scientists’ vision of the world in half a century 2. According to Harvard professor Steven Pinker, predictions about the future_____. A) may invite trouble B) may not come true C) will fool the public D) do more harm than good 3. Professor Bruce Lahn of the University of Chicago predicts that____. A) humans won’t have to donate organs for transplantation B) more people will donate their organs for transplantation C) animal organs could be transplanted into human bodies D) organ transplantation won’t be as scary as it is today 4. According to professor Richard Miller of the University of Michigan, people will____. A) life for as long as they wish B) be relieved from all sufferings C) live to 100 and more with vitality D) be able to live longer than whales 5.Priceton professor Freeman Dyson thinks that____. A) scientists will find alien life similar to ours B) humans will be able to settle on Mars C) alien life will likely be discovered D) life will start to evolve on Mars 6.According to Princeton professor Richard Gott, by setting up a self-sufficient colony on Mars, Humans_____. A) might survive all catastrophes on earth B) might acquire ample natural resources C) Will be able to travel to Mars freely D)Will move there to live a better life 7.Ellen Heber-Katz, professor at the Wistar Institute in Philadelphia, predicts that_____. A) human organs can be manufactured like appliances B) people will be as strong and dynamic as supermen C) human nerves can be replaced by optic fibers D) lost fingers and limbs will be able to regrow 8. Rodney Brooks says that it will be possible for robots to work with humans as a result of the development of _____ 9. The most significant breakthrough predicted by Bill Joy will be an inexhaustible green energy source that can’t be used to make__. 10. According to Geoffrey Miller, science will offer a more practical, universal and rewarding moral framework in place of_______. Part III Listening Comprehension (35minutes) Section A 11. A) The man might be able to play in the World Cup. B) The man’s football career seems to be at an end. C) The man was operated on a few weeks ago. D) The man is a fan of world-famous football players. 12. A) Work out a plan to tighten his budget B) Find out the opening hours of the cafeteria. C) Apply for a senior position in the restaurant. D) Solve his problem by doing a part-time job. 13. A) A financial burden. B) A good companion C) A real nuisance. D) A well-trained pet. 14. A) The errors will be corrected soon. B) The woman was mistaken herself. C) The computing system is too complex. D) He has called the woman several times. 15. A) He needs help to retrieve his files. B) He has to type his paper once more. C) He needs some time to polish his paper. D) He will be away for a two-week conference. 16. A) They might have to change their plan. B) He has got everything set for their trip. C) He has a heavier workload than the woman. D) They could stay in the mountains until June 8. 17. A) They have to wait a month to apply for a student loan. B) They can find the application forms in the brochure. C) They are not eligible for a student loan. D) They are not late for a loan application. 18. A) New laws are yet to be made to reduce pollutant release. B) Pollution has attracted little attention from the public. C) The quality of air will surely change for the better. D) It’ll take years to bring air pollution under control. Questions 19 to 22 are based on the conversation you have just heard. 19. A) Enormous size of its stores. B) Numerous varieties of food. C) Its appealing surroundings. D) Its rich and colorful history. 20. A) An ancient building. B) A world of antiques. C) An Egyptian museum. D) An Egyptian Memorial. 21. A) Its power bill reaches £9 million a year. B) It sells thousands of light bulbs a day. C) It supplies power to a nearby town. D) It generates 70% of the electricity it uses. 22. A) 11,500 B) 30,000 C) 250,000 D) 300,000 Questions 23 to 25 are based on the conversation you have just heard. 23. A) Transferring to another department. B) Studying accounting at a university C) Thinking about doing a different job. D) Making preparations for her wedding. 24. A) She has finally got a promotion and a pay raise. B) She has got a satisfactory job in another company. C) She could at last leave the accounting department. D) She managed to keep her position in the company. 25. A) He and Andrea have proved to be a perfect match. B) He changed his mind about marriage unexpectedly. C) He declared that he would remain single all his life. D) He would marry Andrea even without meeting her. Section B Passage One Questions 26 to 29 are based on the passage you have just heard. 26.A) They are motorcycles designated for water sports. B) They are speedy boats restricted in narrow waterways. C) They are becoming an efficient form of water transportation. D) They are getting more popular as a means or water recreation. 27.A) Water scooter operators’ lack of experience. B) Vacationers’ disregard of water safety rules. C) Overloading of small boats and other craft. D) Carelessness of people boating along the shore. 28.A) They scare whales to death. B) They produce too much noise. C) They discharge toxic emissions. D) They endanger lots of water life. 29.A)Expand operating areas. B) Restrict operating hours. C) Limit the use of water scooters. D) Enforce necessary regulations. Passage Two Questions 30 to 32 are based on the passage you have just heard. 30.A) They are stable. B) They are close. C) They are strained. D) They are changing. 31.A) They are fully occupied with their own business. B) Not many of them stay in the same place for long. C) Not many of them can win trust from their neighbors. D) They attach less importance to interpersonal relations. 32.A) Count on each other for help. B) Give each other a cold shoulder. C) Keep a friendly distance. D) Build a fence between them. Passage Three Questions 33 to 35 are based on the passage you have just heard. 33.A) It may produce an increasing number of idle youngsters. B) It may affect the quality of higher education in America. C) It may cause many schools to go out of operation. D) It may lead to a lack of properly educated workers. 34. A)It is less serious in cities than in rural areas. B) It affects both junior and senior high schools. C) It results from a worsening economic climate. D) It is a new challenge facing American educators. 35. A) Allowing them to choose their favorite teachers. B) Creating a more relaxed learning environment. C) Rewarding excellent academic performance. D) Helping them to develop better study habits. Section C I'm interested in the criminal justice system of our country. It seems to me that something has to be done if we’re to (36) ___ as a country. I certainly don't know what the answers to our problems are. Things certainly get (37) ____in a hurry when you get into them. But I wonder if something couldn't be done to deal with some of these problems. One thing I'm concerned about is our practice of putting (38) _____ in jail who haven't harmed anyone. Why not work out some system (39) _____ they can pay back the debts they owe society instead of (40) ___ another debt by going to prison, and of course, coming under the (41) ____of hardened criminals? I'm also concerned about the short prison sentences people are (42) ______ for serious crimes. Of course, one alternative to this is to (43) ______ capital punishment, but I'm not sure I would be for that. I'm not sure it's right to take an eye for eye. (44) _____. I also think we must do something about the insanity plea. In my opinion, anyone who takes another person’s life intentionally is insane; however, (45) _____. It’s sad, of course, that a person may have to spend the rest of his life, or (46) ______. Part IV Reading Comprehension (Reading in Depth) (25 minutes) Section A Questions 47 to 51 are based on the following passage. If movie trailers(预告片)are supposed to cause a reaction, the preview for "United 93" more than succeeds. Featuring no famous actors, it begins with images of a beautiful morning and passengers boarding an airplane. It takes you a minute to realize what the movie’s even about. That’s when a plane hits the World Trade Center. the effect is visceral(震撼心灵的). When the trailer played before "Inside Man" last week at a Hollywood theater, audience members began calling out, "Too soon!" In New York City, the response was even more dramatic. The Loews theater in Manhattan took the rare step of pulling the trailer from its screens after several complaints. “United 93” is the first feature film to deal explicitly with the events of September 11, 2001, and is certain to ignite an emotional debate. Is it too soon? Should the film have been made at all? More to the point, will anyone want to see it? Other 9/11 projects are on the way as the fifth anniversary of the attacks approaches, most notably Oliver Stone's " World Trade Center." but as the forerunner, “United 93” will take most of the heat, whether it deserves it or not. The real United 93 crashed in a Pennsylvania field after 40 passengers and crew fought back against the terrorists. Writer-director Paul Greengrass has gone to great lengths to be respectful in his depiction of what occurred, proceeding with the film only after securing the approval of every victim's family. "Was I surprised at the agreement? Yes. Very. Usually there’re one or two families who're more reluctant," Greengrass writes in an e-mail. "I was surprised at the extraordinary way the United 93 families have welcomed us into their lives and shared their experiences with us." Carole O'Hare, a family member, says, “They were very open and honest with us, and they made us a part of this whole project.” Universal, which is releasing the film, plans to donate 10% of its opening weekend gross to the Flight 93 National Memorial Fund. That hasn't stopped criticism that the studio is exploiting a national tragedy. O’Hare thinks that’s unfair. “This story has to be told to honor the passengers and crew for what they did,” she says. “But more than that, it raises awareness. Our ports aren’t secure. Our borders aren’t secure. Our airlines still aren’t secure, and this is what happens when you’re not secure. That’s the message I want people to hear.” 47. The trailer for “United 93” succeeded in ________ when it played in the theaters in Hollywood and New York City. 48. The movie “United 93” is sure to give rise to _______________. 49. What did writer-director Paul Greengrass obtain before he proceeded with the movie? 50. Universal, which is releasing “United 93”, has been criticized for _________. 51. Carole O’Hare thinks that besides honoring the passengers and crew for what they did, the purpose of telling the story is to _________ about security. Part IV Reading Comprehension (Reading in Depth) (25 minutes) Section A Questions 47 to 51 are based on the following passage. If movie trailers(预告片)are supposed to cause a reaction, the preview for "United 93" more than succeeds. Featuring no famous actors, it begins with images of a beautiful morning and passengers boarding an airplane. It takes you a minute to realize what the movie’s even about. That’s when a plane hits the World Trade Center. the effect is visceral(震撼心灵的). When the trailer played before "Inside Man" last week at a Hollywood theater, audience members began calling out, "Too soon!" In New York City, the response was even more dramatic. The Loews theater in Manhattan took the rare step of pulling the trailer from its screens after several complaints. “United 93” is the first feature film to deal explicitly with the events of September 11, 2001, and is certain to ignite an emotional debate. Is it too soon? Should the film have been made at all? More to the point, will anyone want to see it? Other 9/11 projects are on the way as the fifth anniversary of the attacks approaches, most notably Oliver Stone's " World Trade Center." but as the forerunner, “United 93” will take most of the heat, whether it deserves it or not. The real United 93 crashed in a Pennsylvania field after 40 passengers and crew fought back against the terrorists. Writer-director Paul Greengrass has gone to great lengths to be respectful in his depiction of what occurred, proceeding with the film only after securing the approval of every victim's family. "Was I surprised at the agreement? Yes. Very. Usually there’re one or two families who're more reluctant," Greengrass writes in an e-mail. "I was surprised at the extraordinary way the United 93 families have welcomed us into their lives and shared their experiences with us." Carole O'Hare, a family member, says, “They were very open and honest with us, and they made us a part of this whole project.” Universal, which is releasing the film, plans to donate 10% of its opening weekend gross to the Flight 93 National Memorial Fund. That hasn't stopped criticism that the studio is exploiting a national tragedy. O’Hare thinks that’s unfair. “This story has to be told to honor the passengers and crew for what they did,” she says. “But more than that, it raises awareness. Our ports aren’t secure. Our borders aren’t secure. Our airlines still aren’t secure, and this is what happens when you’re not secure. That’s the message I want people to hear.” 47. The trailer for “United 93” succeeded in ________ when it played in the theaters in Hollywood and New York City. 48. The movie “United 93” is sure to give rise to _______________. 49. What did writer-director Paul Greengrass obtain before he proceeded with the movie? 50. Universal, which is releasing “United 93”, has been criticized for _________. 51. Carole O’Hare thinks that besides honoring the passengers and crew for what they did, the purpose of telling the story is to _________ about security. Section B Passage One Questions 52 to 56 are based on the following passage. Imagine waking up and finding the value of your assets has been halved. No, you’re not an investor in one of those hedge funds that failed completely. With the dollar slumping to a 26-year low against the pound, already-expensive London has become quite unaffordable. A coffee at Starbucks, just as unavoidable in England as it is in the United States, runs about $8. The once all-powerful dollar isn’t doing a Titanic against just the pound. It is sitting at a record low against the euro and at a 30-year low against the Canadian dollar. Even the Argentine peso and Brazilian real are thriving against the dollar. The weak dollar is a source of humiliation, (屈辱),for a nation’s self-esteem rests in part on the strength of its currency. It’s also a potential economic problem, since a declining dollar makes imported food more expensive and exerts upward pressure on interest rates. And yet there are substantial sectors of the vast U.S. economy-from giant companies like Coca-Cola to mom-and-pop restaurant operators in Miami-for which the weak dollar is most excellent news. Many Europeans may view the U.S. as an arrogant superpower that has become hostile to foreigners. But nothing makes people think more warmly of the U.S. than a weak dollar. Through April, the total number of visitors from abroad was up 6.8 percent from last year. Should the trend continue, the number of tourists this year will finally top the 2000 peak? Many Europeans now apparently view the U.S. the way many Americans view Mexico-as a cheap place to vacation, shop and party, all while ignoring the fact that the poorer locals can’t afford to join the merrymaking. The money tourists spend helps decrease our chronic trade deficit. So do exports, which thanks in part to the weak dollar, soared 11 percent between May 2006 and May 2007. For first five months of 2007, the trade deficit actually fell 7 percent from 2006. If you own shares in large American corporations, you’re a winner in the weak-dollar gamble. Last week Coca-Cola’s stick bubbled to a five-year high after it reported a fantastic quarter. Foreign sales accounted for 65 percent of Coke’s beverage (饮料)business. Other American companies profiting from this trend include McDonald’s and IBM. American tourists, however, shouldn’t expect any relief soon. The dollar lost strength the way many marriages break up-slowly, and then all at once. And currencies don’t turn on a dime. So if you want to avoid the pain inflicted by the increasingly pathetic dollar, cancel that summer vacation to England and look to New England. There, the dollar is still treated with a little respect. 52. Why do Americans feel humiliated? A) Their economy is plunging B) Their currency has slumped C) They can’t afford trips to Europe D) They have lost half of their assets. 53.How does the current dollar affect the life of ordinary Americans? A) They have to cancel their vacations in New England. B) They find it unaffordable to dine in mom-and-pop restaurants. C) They have to spend more money when buying imported goods. D) They might lose their jobs due to potential economic problems. 54. How do many Europeans feel about the U.S with the devalued dollar? A) They feel contemptuous of it B) They are sympathetic with it. C) They regard it as a superpower on the decline. D) They think of it as a good tourist destination. 55. what is the author’s advice to Americans? A) They treat the dollar with a little respect B) They try to win in the weak-dollar gamble C) They vacation at home rather than abroad D) They treasure their marriages all the more. 56. What does the author imply by saying “currencies don’t turn on a dime” (Line 2,Para 7)? A) The dollar’s value will not increase in the short term. B) The value of a dollar will not be reduced to a dime C) The dollar’s value will drop, but within a small margin. D) Few Americans will change dollars into other currencies. Passage Two Questions 57 to 61 are based on the following passage. In the college-admissions wars, we parents are the true fights. We’re pushing our kids to get good grades, take SAT preparatory courses and build resumes so they can get into the college of our first choice. I’ve twice been to the wars, and as I survey the battlefield, something different is happening. We see our kids’ college background as a prize demonstrating how well we’ve raised them. But we can’t acknowledge that our obsession(痴迷) is more about us than them. So we’ve contrived various justifications that turn out to be half-truths, prejudices or myths. It actually doesn’t matter much whether Aaron and Nicole go to Stanford. We have a full-blown prestige panic; we worry that there won’t be enough prizes to go around. Fearful parents urge their children to apply to more schools than ever. Underlying the hysteria(歇斯底里) is the belief that scarce elite degrees must be highly valuable. Their graduates must enjoy more success because they get a better education and develop better contacts. All that is plausible—and mostly wrong. We haven’t found any convincing evidence that selectivity or prestige matters. Selective schools don’t systematically employ better instructional approaches than less selective schools. On two measures—professors’ feedback and the number of essay exams selective schools do slightly worse. By some studies, selective schools do enhance their graduates’ lifetime earnings. The gain is reckoned at 2-4% for every 100-poinnt increase in a school’s average SAT scores. But even this advantage is probably a statistical fluke(偶然). A well-known study examined students who got into highly selective schools and then went elsewhere. They earned just as much as graduates from higher-status schools. Kids count more than their colleges. Getting into Yale may signify intelligence, talent and ambition. But it’s not the only indicator and, paradoxically, its significance is declining. The reason: so many similar people go elsewhere. Getting into college is not life’s only competition. In the next competition—the job market and graduate school—the results may change. Old-boy networks are breaking down. princeton economist Alan Krueger studied admissions to one top Ph.D. program. High scores on the GRE helped explain who got in; degrees of prestigious universities didn’t. So, parents, lighten up. The stakes have been vastly exaggerated. Up to a point, we can rationalize our pushiness. America is a competitive society; our kids need to adjust to that. But too much pushiness can be destructive. The very ambition we impose on our children may get some into Harvard but may also set them up for disappointment. One study found that, other things being equal, graduates of highly selective schools experienced more job dissatisfaction. They may have been so conditioned to being on top that anything less disappoints. 57.Why dose the author say that parents are the true fighters in the college-admissions wars? A) They have the final say in which university their children are to attend. B) They know best which universities are most suitable for their children. C) They have to carry out intensive surveys of colleges before children make an application. D) They care more about which college their children go to than the children themselves. 58.Why do parents urge their children to apply to more schools than ever? A) They want to increase their children’s chances of entering a prestigious college. B)They hope their children can enter a university that offers attractive scholarships. C) Their children will have a wider choice of which college to go to. D) Elite universities now enroll fewer student than they used to. 59.What does the author mean by “kids count more than their colleges”Line1, para.4? A) Continuing education is more important to a person’s success. B) A person’s happiness should be valued more than their education. C) Kids’ actual abilities are more important than their college background. D) What kids learn at college cannot keep up with job market requirements. 60.What does Krueger’s study tell us? A) Getting into Ph.D. programs may be more competitive than getting into college. B) Degrees of prestigious universities do not guarantee entry to graduate programs. C) Graduates from prestigious universities do not care much about their GRE scores. D) Connections built in prestigious universities may be sustained long after graduation. 61.One possible result of pushing children into elite universities is that______ A) they earn less than their peers from other institutions B) they turn out to be less competitive in the job market C) they experience more job dissatisfaction after graduation D) they overemphasize their qualifications in job application Part V Cloze Seven years ago, when I was visiting Germany, I met with an official who explained to me that the country had a perfect solution to its economic problems. Watching the U.S. economy 62 during the’ 90s, the Germans had decided that they, too, needed to go the high-technology _63_. But how? In the late’ 90s, the answer schemed obvious: Indians. _64_ all, Indian entrepreneurs accounted for one of every three Silicon Valley start-ups. So the German government decided that it would _65_ Indians to Germany just as America does: by _66_ green cards. Officials created something called the German Green Card and _67_ that they would issue 20,000 in the first year. _68_, the Germans expected that tens of thousands more Indians would soon be begging to come, and perhaps the _69_ would have to be increased. But the program was a failure. A year later _70_ half of the 20,000 cards had been issued. After a few extensions, the program was _71_. I told the German official at the time that I was sure the _72_ would fail. It’s not that I had any particular expertise in immigration policy, _73_ I understood something about green cards, because I had one (the American _74_). The German Green Card was misnamed, I argued, _75_ it never, under any circumstances, translated into German citizenship. The U.S. green card, by contrast, is an almost _76_ path to becoming American (after five years and a clean record). The official _77_ my objection, saying that there was no way Germany was going to offer these people citizenship. “We need young tech workers,” he said. “That’s what this program is all _78_.” So Germany was asking bright young _79_ to leave their country, culture and families, move thousands of miles away, learn a new language and work in a strange land—but without any _80_ of ever being part of their new home. Germany was sending a signal, one that was _81_ received in India and other countries, and also by Germany’s own immigrant community. 62. A) soar B) hover C) amplify D) intensify 63. A) circuit B) strategy C) trait D) route 64. A) Of B) After C) In D) At 65. A) import B) kidnap C) convey D) lure 66. A) offering B) installing C) evacuating D) formulating 67. A) conferred B) inferred C) announced D) verified 68. A) Specially B) Naturally C) Particularly D) Consistently 69. A) quotas B) digits C) measures D) scales 70. A) invariably B) literally C) barely D) solely 71. A) repelled B) deleted C) combated D) abolished 72. A) adventure B) response C) initiative D) impulse 73. A) and B) but C) so D) or 74. A) heritage B) revision C) notion D) version 75. A) because B) unless C) if D) while 76. A) aggressive B) automatic C) vulnerable D) voluntary 77. A) overtook B) fascinated C) submitted D) dismissed 78. A) towards B) round C) about D) over 79. A) dwellers B) citizens C) professionals D) amateurs 80. A) prospect B) suspicion C) outcome D) destination 81. A) partially B) clearly C) brightly D) vividly Part VI Translation 82. We can say a lot of things about those ________________(毕生致力于诗歌的人): they are passionate, impulsive, and unique. 83. Mary couldn’t have received my letter, ___________ (否则她上周就该回信了). 84. Nancy is supposed to ____________________ (做完化学实验) at least two weeks ago. 85. Never once ___________________ (老两口互相争吵) since they were married 40 years ago. 86. ________________________ (一个国家未来的繁荣在很大程度上有赖于) the quality of education of its

69,369

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧