|
|
February 28 From: http://wiki.answers.com/Q/Is_it_better_to_use_malloc_or_calloc_to_allocate_memory In general using malloc is faster, since calloc initializes the allocated memory to contain all zeroes. If this is what you want, however, then calloc can be used. The results can vary among different operating systems and environments, though. Memory allocation in an OS that uses floating blocks in heaps, such as Microsoft Windows and MacOS, should use the OS-native memory allocators instead. "Use malloc() almost always and calloc() almost never." The reason is that the initialization to zero that calloc() performs is usually not very helpful: - The initialization to "all-bits-zero" is not necessarily the same as initialization to "all-data-zero." C says very little about the representation of values in memory, nothing at all for floating-point or pointer values. On many machines all-bits-zero representations will in fact correspond to f.p. zeroes or null pointers, but this is not guaranteed by the language and there have been machines where the correspondence did not hold. If you get in the habit of using calloc() to initialize f.p. and pointer items, you may be heading for trouble. - Usually, one allocates a chunk of dynamic memory in order to store something in it -- and when you store something in it, you'll overwrite whatever was there before. Thus, the initialization performed by calloc() is usually not needed anyhow. There are occasional exceptions where all- bits-zero initialization is helpful, but they are unusual. Comments: The most important point is the red words. I think most of C teachers would not emphasize this point. If you know this, you can evulate everything by yourself. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// From: http://www.coders2020.com/what-is-the-difference-between-malloc-and-calloc What is the difference between malloc() and calloc()? First lets look at the prototypes of these two popular functions.. #include
void *calloc(size_t n, size_t size);
void *malloc(size_t size);
The two functions malloc() and calloc() are functionally same in that they both allocate memory from a storage pool (generally called heap). Actually, the right thing to say is that these two functions are memory managers and not memory allocators. Memory allocation is done by OS specific routines (like brk() and sbrk()). But lets not get into that for now...
Here are some differences between these two functions.. * malloc() takes one argument, whereas calloc() takes two.
* calloc() initializes all the bits in the allocated space to zero (this is all-bits-zero!, where as malloc() does not do this.
* A call to calloc() is equivalent to a call to malloc() followed by one to memset().
calloc(m, n)
is essentially equivalent to
p = malloc(m * n);
memset(p, 0, m * n);
Using calloc(), we can carry out the functionality in a faster way than a combination of malloc() and memset() probably would. You will agree that one libray call is faster than two calls. Additionally, if provided by the native CPU, calloc() could be implementated by the CPU's "allocate-and-initialize-to-zero" instruction. * The reason for providing the "n" argument is that sometimes it is required to allocate a number ("n") of uniform objects of a particular size ("size"). Database application, for instance, will have such requirements. Proper planning for the values of "n" and "size" can lead to good memory utilization.
February 26  p2pnet news | Mobiles:- Who’d want a clunky iPhone after seeing this? It’s a Morph, a concept device designed as a bridge between highly advanced technologies and their potential benefits to end-users, says Nokia. But sadly, it’ll be a while before we can get our hands on one. Featured in The Museum of Modern Art ‘Design and The Elastic Mind’ exhibition, the Morph, "showcases some revolutionary leaps being explored by Nokia Research Center (NRC) in collaboration with the Cambridge Nanoscience Centre (United Kingdom) - nanoscale technologies that will potentially create a world of radically different devices that open up an entirely new spectrum of possibilities," it states. "Fibril proteins are woven into a three dimensional mesh that reinforces thin elastic structures. Using the same principle behind spider silk, this elasticity enables the device to literally change shapes and configure itself to adapt to the task at hand." Or as PC World sums it up: "Imagine tapping out text messages on a device the size of an index card and as flat as a piece of paper, then folding it in thirds to hold it to your ear and make a phone call. Refold it in a slightly different shape and wrap it around your wrist, where it becomes a watch and also communicates with an ear bud that lets you talk hands free." Click here to download a video showing the Morph morphing. From: http://www.p2pnet.net/story/15053 Comments: WOOOOOOOW!!!!!!!!!!!!!!! 2/26/2008 1:50:00 PM Parma-Milan, three fouls in the first twenty minutes. Milan-Palermo, three fouls in the first twenty nine. Carrozzieri, after Bovo, the Kaka method is having a following. But the most safeguarded are his opponents. MILAN – The initial "score" of the last two league games on Ricardo Kaka? Here you go. Parma-Milan, first half: in the 7th minute a foul by Morrone from behind, in the 17th minute a foul by Dessena on the edge of the penalty area, in the 20th minute a foul by Morrone. These last in particular is the model of the Kaka-method. The “targeted” player did a bad slide tackle on the player’s foot, risking everything: leg, or ankle, it doesn’t matter, on him you have to risk. It’s not over. Milan-Palermo, first half: after 1 minute and 43 seconds a bad foul by Guana, from behind, exactly on the knee which is hurting Kaka. In the 22nd minute a foul by Migliaccio in midfield, not even whistled by the referee. In the 29th minute a foul by Bresciano, from behind, on Kaka who was launched towards the penalty area, with Ricky, who full of knocks and pain, has a reaction towards the referee. Amongst these two games, London, where the loyalty in the Champions League and the sports culture are higher. What really hits us in the Italian league, is not just the numerous number of fouls on Kaka, on which the referees of our league overlook, but the scientific factor. It’s never the same player to make these fouls. There is an alteration between one player and another. As if it was a strategy. Almost the sign of a preparation. And here evidently the referees have no fault at all. The hammering which Kaka is suffering is the same which had mined the physique and resistance of Marco Van Basten. The Dutch star played his last game at the highest level at 28 years of age. It was November 1992 against Gothenborg at San Siro. Then here never came back. No! It must not happen for Kaka too. There is no post-Golden Ball crisis and there is no world class player playing badly. We are simply facing a player who is hunted, who has to stop for 15-20 days to manage his problems, then evidently does not return on the pitch at his best. The reality is that whereas the Milan opponents take turns in fouling Kaka, and the first minutes foul does not receive any sanction, it is becoming a custom of most Italian teams towards Kaka. The Rossoneri’s team are therefore risking an important part of the season against Arsenal. In the Kaka will recover, he will prepare himself and he will do his best to be in front of 80,000 fans at San Siro. Until the next foul, or the ‘ordinary administration’ of the Italian referees. So in the end, until when? From: http://www.acmilan.com/NewsDetail.aspx?idNews=62592 February 16 猪,怎么都是猪!它拉不出什么思想! 杀猪的人原来就是猪,现在翻身做了猪人,管起来猪比原来的人更狠! 这样的猪人,不杀光,猪们能够幸福吗! 杀杀杀杀杀!!!!!

February 09 从春晚说起:总有一种无耻让我们泪流满面 很久没有写什么东西了。可是我实在无话可说,我只觉得所住的并非人间,而是一幕荒诞剧的舞台。触目可及的荒诞到无耻、可痛到可笑的拙劣表演,洋溢在我的周围,使我艰于呼吸视听,那里还能有什么言语?长歌当哭,是必须在痛定之后的。而旧痛未定又有新痛出炉、荒谬绝伦而又毫无遮掩的无耻让人痛极甚至笑起来,笑里却有眼泪要夺眶而出,为这个我深爱着却又如此苦命的中国。 在陪着家人看春晚时,我油然想到电影《阿甘正传》里的一个镜头:当圣诞节的烟花绽放在夜空,失去双腿的邓·泰勒上尉却呆坐在轮椅里,表情木然,和周围欢呼的人群形成鲜明的反差。-----是的,在看不到未来和希望的时刻,那不是属于他的圣诞节。 当春晚主持人一次次告诉大家手机短信平台的号码时,当屏幕上一次次打出这些短信平台的号码时,它无疑也在提醒中国还没有手机的8.5亿人:这个节目环节不需要你的参与,大熊猫命名与你无关,因为你没有手机。而一个摈弃了8.5亿人的投票结果,究竟能有多少代表性? 当然对央视来说,当短信代表着他们的春晚收益时,那些没有手机的人群的感受、所谓投票的代表性也就无关紧要了。1.3亿短信发送量、一千三百万收入,倾刻间赚得盆满钵满。----我努力想在屏幕上找到"本条短信收费0.1元"的提示,用以修正对于央视的人格偏见,却始终没有看到短信收费的提示,而我对央视的人格偏见却再一次被验证了:原来一条短信收费"果然"不是0.1元而是1元钱,这还没完,发完短信后,(引用)"那个2006的信息台整天往我的手机上发收费信息,且北京移动声称不能取消,严重扰乱了我的正常生活...遗憾的是,作为一个国家电视台,这种鸡鸣狗盗的事情竟是它赖以生存的唯一手段,不禁让我想起某类人,真是一路货色!" 春晚,多么"气势磅礴、博大精深、波澜壮阔、韵味雅致"的春晚啊!多么具有突破性和创造性的舞美、灯光、音乐啊!导演津津乐道眉飞色舞地说:他做到了在舞台上真的可以下一场雪!呜呼,一场堂而皇之的大雪底下掩盖掉了多少困窘、眼泪、耻辱和贫苦啊!《开心 100》节目访谈张纪中赵宝刚王小帅贾樟柯这些导演,请他们说说自己会怎样导演春晚。这些导演说的无非是欢快、闹腾...但在笔者看来,如果让他们导演春晚,结局绝对好不了多少。为什么?因为这些春晚的导演、大腕、主持、演员、策划、灯光,包括现场的观众,可以说都是这个社会的贵族,他们不用担心过了春晚买不到外出打工的火车票、不用担心没有着落的工作、不用担心30年的房贷(更不用说拿不出房贷首付的人们了)、儿女的高额学费和医治伤病的高价药费... 被这些沉甸甸的问题压迫着的人们,不管春晚的屏幕多么欢快闹腾,他们能够真正高兴起来吗? 肯定会有人说笔者把春晚要承担的责任堆积得太多了,它的功能不就是让大家笑一笑、乐一乐?如果这样说,那么笔者断言,在一个大家忧心忡忡的时代,春晚无论如何达不到让大家喜从心底笑逐颜开的目的。 在笔者看来,其实只需要一个节目就可以了。真的,只需要一个节目,因为这个节目,其他节目都将只是陪衬,而这台春晚将足以温暖千家万户并被大家铭记心头,也必将有千万人为这个节目流下感动而欣喜的泪水。 这个节目就是:请国家的最高领导人站在春晚台上,除了拜年以外,能够和大家反思过去一年的功过得失,诚挚地表达 party和go-vern-ment带领全国人民迈向健康幸福社会的坚定信心和有力措施。 请那些导致了医疗、教育、电力、股市、农业、房地产... 改革失策的最高主管领导站出来,向全国人民真诚地说一声:对不起,我会改。 中国人民是如此的善良淳朴,他们为医疗、教育、电力、股市、农业、房地产...承受了如此之多的苦难,他们一次又一次地原谅了这些失策带来的苦难。但在这举国团聚的日子里,请用真诚换取真诚,请说出那一声早该说出的"对不起 "吧,让他们看到爱和尊重。谁说涂脂抹粉式的锣鼓喧天、一团和气才是喜庆?真诚和理解的泪水更能洗去屈辱、萌生憧憬和希望。----一个萌生希望和憧憬的春晚,难道还有比这收获更大的吗? 而当李咏、朱军、董卿周涛、大陆港台各式明星大腕春晚结束开着私家车离去以后,一切依旧。紧缺的火车票依旧、没有着落的工作依旧、30年的房贷依旧、儿女的学费依旧、医药费依旧......春晚,不过是个应景的爆竹而已,一声锐响后,空虚失落依旧,光天化日下的无耻依旧,这是个怎样的寂静的春天啊。 小说《阿甘正传》的结尾是这样写的:"不过,我跟你说,朋友:有时候到了晚上,我仰望星星,看见整个天空就那么铺在那儿,可别以为我什么也不记得。我仍旧跟大家一样有梦想,偶尔我也会想到换个情况人生会是什么样儿。然后,眨眼之间,我已经四十、五十、六十岁了,你明白吧?" 转自: http://bbs.winzheng.com/viewthread.php?tid=1581503&extra=page%3D1 永远无法停止的是: 杀杀杀!!!!!! January 27 The Eleven Satanic Rules of the Earth From: http://www.metalhubs.com/2008/01/26/the-eleven-satanic-rules-of-the-earth/ by admin in January 26th, 2008 As lots of metal head like all the satanic and anti-christians themes here are The Eleven Satanic Rules of the Earth as describe by Anton Szandor LaVey, 1967 c.e. The Eleven Satanic Rules of the Earth I Do not give opinions or advice unless you are asked. II Do not tell your troubles to others unless you are sure that they want to hear them. III When in another’s lair, show him respect or else do not go there. IV If a guest in your lair annoys you, treat him cruelly and without mercy. V Do not make sexual advances unless you are given the mating signal. VI Do not take that which does not belong to you unless it is a burden to the person and he cries out to be relieved. VII Acknowledge the power of magic if you have used it successfully to obtain your desires. If you deny the power of magic after having called upon it with success, you will lose all you have obtained. VIII Do not complain about anything to which you need not subject yourself. IX Do not harm little children. X Do not kill non-human animals unless attacked or for your food. XI When walking in open territory, bother no one. If someone bothers you, ask him to stop. If he does not stop, destroy him. Anton Szandor LaVey, 1967 c.e. ================================================================================= The Nine Satanic Statements From: http://www.metalhubs.com/2008/01/26/the-nine-satanic-statements/ by admin in January 26th, 2008 The Nine Satanic Statements I Satan represents indulgence, instead of abstinence! II Satan represents vital existence, instead of spiritual pipe dreams! III Satan represents undefiled wisdom, instead of hypocritical self-deceit! IV Satan represents kindness to those who deserve it, instead of love wasted on ingrates! V Satan represents vengeance, instead of turning the other cheek! VI Satan represents responsibility to the responsible, instead of concern for psychic vampires! VII Satan represents man as just another animal, sometimes better, more often worse than those that walk on all fours, who, because of his “divine spiritual and intellectual development, has become the most vicious animal of all! VIII Satan represents all of the so-called sins, as they all lead to physical, mental, or emotional gratification! IX Satan is the best friend the church has ever had, as he has kept it in business all these years! From the Satanic Bible
|
|
|
|