Monday, October 25, 2010

Audio Bible C language compiler raises the question



Basic interpretation
This section focuses on the following C compiler, triggered by the characteristics of two series of common programming problems.
On the C files are compiled:
C program consists of several small programs (. C file), the compiler compile these were a few small programs, then the program will link them together to form a target code. Since the compiler can only compile a file each time, so it can not immediately check with the source files need to be found a few errors.
The function parameters and return values with a temporary variable
C compiler, would function to establish the parameters of the provisional parameters, which may be implicit return value passing a pointer. Because these temporary variables implied the existence of so in some cases, especially when there is a pointer, will trigger a series of problems.
C file contained in the header file and the C language with compiler

C language header files are included and. C files compiled with the first issue of the document will be reflected. C file compilation.
Questions: C files are compiled

I have an array of a custom in f1.c in, but I would like to calculate it in f2.c number of elements, sizeof can be used to achieve this purpose?

Answer and Analysis:

The answer is no, you have no way to achieve the purpose, essentially because the sizeof operator is in the "compile-time (compile time)" works, and C language compilation unit is each individual. C files to compile (other languages also the case). Therefore, sizeof identify a source file with a size of the array, but defined in another source file for the array it can do nothing, because it is already "run-time (run time)" can be sure about everything.

One thing to want to do, always a way, the following three options to provide solution to this problem:

1), define a global variable, it remember the size of the array, in another. C file, we pass to access this global variable to get the array size of the message (if there is a disease worth the ^_^)銆?br />
2), in a. H file size of the array using macro definitions, such as # define ARRAY_SIZE 50, then the two source files are included in this. H files to get through the definition of direct access to ARRAY_SIZE different. C files The size of the array.

3), set the last element of the array as a special value, such as 0, -1, NULL, etc., and then we pass through the array to find the end of this particular element, and thus determine the length of the array (low efficiency of this approach is simple-minded, ).

Question: passing pointer function return value implied

The following code can work, but at the end of the program will generate a fatal error. What are the reasons?

struct list
(
char * item;
struct list * next;
)

main (argc, argv)
(
...
)

Answer and Analysis:

The reason is simple, a little note that is not difficult to find the definition of the structure list in parentheses behind the right flowers can add a semicolon to solve this problem:

struct list
(
char * item;
struct list * next;
); / / Missing semicolon can not do this!

Well, the problem is solved, but, you know what this error actually resulted in a fatal problem? The problem is not so simple on the surface of, OK, let's look at the truth behind things.

First look at the following code:

VOID Func (struct my_struct stX)
(
.......
)
struct my_struct stY = {...};
Func (stY);

When you call the function Func of time is to structure the value of the variable stY a copy to the call stack, thereby passed as parameters to the function FUNC, this is called the C language the parameters passed by value. I believe that you must be very clear, then you should know: If the return value is a structure variable, then the function should be how to value it returns to the caller? Consider the following code:

struct my_structFunc (VOID)
(
.......
)
struct my_struct stY = Func ();

At this point the return value of function Func is a structure type of value, this return value of Pi in memory of a dark terror of 鍦版柟 and arranged a pointer to the place (provisionally called "mysterious pointer"), but the pointer will by the C language compiler as a hidden parameter to the function Func. When the function Func to return, the compiler generated code will hide this from the memory area pointed to the value of copy to the return structure stY in order to complete the structure of the variable value back to the caller.

Do you understand the above mentioned stuff, then the real cause of the problem today, also ready to come out of the:

Because the definition of struct list {...} does not add a semicolon followed, leading to the main function main (argc, argv) understood by the compiler return value structure is a function of variables, so expect argc and argv in addition to the first outside three parameters, namely, that we mentioned above, the incoming implied a "mysterious pointer." But, you know, here is the main function of the function, main function of the parameter is the boot code from the program (startup code) provided. The startup code of course, that the main () should only be born with two parameters, to "mysterious pointer" and, of course not, this way, main () when given a free hand to go back to access the call stack that it does not exist The third parameter (the mysterious pointer), this has led to the illegal access, resulting in a fatal problem. This is the real source of the problem.

Recommendation:

1), try to structure a pointer variable, not the structure itself as a function of parameters, or memory copy function call overhead from time to time small, especially for those who call frequently, the situation of a large structure.

2), the structure must be defined in the back of a semicolon, after the above paragraph about my major, I am sure you will not commit the same error



Problem: the parameters of the function the compiler will implicitly create a temporary copy

Test run the following function does what kind of results?

void GetMemory2 (char ** p, int num)
(
* P = (char *) malloc (num);
)

void Test (void)
(
char * str = NULL;
GetMemory (& str, 100);
strcpy (str, hello);
printf (str);
)

Answer and Analysis:

This is Lin Rui, "C / C + + high-quality programming guide," the above example, use of them about.

This call will produce the following two consequences:

1), can output hello

2), memory leak

Another related question:

Will run the Test function, what kind of results?

void GetMemory (char * p)
(
p = (char *) malloc (100);
)

void Test (void)
(
char * str = NULL;
GetMemory (str);
strcpy (str, hello world);
printf (str);
)

Answer and Analysis:

Serious consequences, the result is a crash running, by running the debugger we can see, after GetMemory, Test function of str is still NULL. One can imagine that a call

strcpy (str, hello world);

Program is bound to collapse trouble.

Analysis:

C compiler will always make for the function of each parameter temporary copy of a copy of the pointer parameters is p _p, compiler allows _p = p. If the function body of the application to modify the content of the _p, p parameters on the content of lead changes accordingly. This is the pointer can be used as output parameters reasons. In this case, _p apply for a new memory, just _p memory address within the meaning of change, but the p stuff. Therefore, the function GetMemory not output anything, if you want to output dynamic memory, use pointer to pointer, or use a pointer pointing to references.

Question: header file and include it. C files compiled with Q

The following code is very short, it seems there is no problem, but the compiler will report an error, what problems may arise where?

# Include someheader.h
int myint = 0;

Answer and Analysis:

Do not stare at int myint = 0; look, this one is a C language assignment should be the most simple statements, the problem will definitely not out on it, the problem may only appear in the someheader.h, the most common is the header file The last line of the statement (function Ye Hao, variable means) did not use a semicolon; the end, then the compiler will combine it myint variables to consider, naturally wrong.

The main problem is to remind you that when the positioning of ideas to expand, it may have to consider whether the header file contains a problem.

Conclusion: The header files are included and. C files compiled with the first issue of the document will be reflected. C files to compile in, and remember.







相关链接:



FrontPage create thumbnails and images with overlapping effects



Symantec Said the new storm worm detected



Crossroads 3G



5 easy ways to prolong laptop life



Useful tool for Snippet COMPILER



Under The Iceberg



WMV To MOV



Review Network Monitoring



MPEG4 to WMV



Sail a meteoric rise THROUGH media and public relations



Flash To MPEG



Kingsoft vice president said the leaked report seen those INTERNAL to track down leaks



Recommend Source Editors



Refrain from the trap into the concept of selection need to know ourselves and HR



Yuan Meng: Ubuntu 9.10 new version of the debut



Monday, October 18, 2010

Further than South Korea, Japan and China Shipbuilding Industry


1 Introduction
The face of new opportunities for the development of the 21st century, China State Shipbuilding Corporation made the "531" development goals, namely in 2005, 2010, into the world shipbuilding group "top five", "top three" basis, and further accelerate development, and then five years of efforts, by 2015 the world's No. 1 shipbuilding group, to promote our country become the world's No. 1 shipbuilding power.
However, we must clearly see that compared with the advanced shipbuilding countries, currently China's shipbuilding industry in terms of ship size, skill level, supporting capacity, or in terms of production efficiency, there were significant gaps still exist in the development of many difficulties and problems. Although our series the third largest ship in the world, but China's shipbuilding output and first and second gap between the large. In shipbuilding technology, many high-tech, high value-added ship types, such as large container ships, large-scale liquefied petroleum gas (LPG) ships, liquefied natural gas (LNG) ships, boats and other luxury travel is still in development stage. Targeted only do a good job for a short period of time, in several key aspects of the advanced shipbuilding countries, shorten the gap to ship construction market in the world occupy the foot, making China's shipbuilding industry are sustained and steady development of , and ultimately the world's No. 1 shipbuilding power ambitions. Moreover, today's information age, technology is wide as long as we adopt effective measures, means properly, can catch up with advanced shipbuilding companies, to shorten the gap with them. The key is that we should be able to objectively see the gap between us where we are not afraid of differences, fear of difference is that we do not know where.
Two major shipbuilding companies hardware comparison
Shipbuilding capacity of shipbuilding infrastructure is a basic protection, reflects the strength of a country's shipbuilding base. South Korea, Japan, China's major shipbuilding companies were major shipbuilding facilities in Table 1. Table 2, Table 3. (In this section, will be wider than 34 m, berth length of more than 205 m, dock length over 230 m to more conventional Panamax vessels built facility known as the major shipbuilding facilities; and width of more than 55m, longer than 300 m of the dock that To have the ability to build more facilities for giant tankers.)







According to statistics, South Korea 59.3%, 60.0% of Japan's major shipbuilding facilities have the capacity of the construction of giant oil tankers, while China accounted for only 22.6%. Hyundai Heavy Industries as the world's leading enterprises in the shipbuilding industry, 75% of its shipyard to build a giant oil tanker.
Most of Korea's major shipyards in the 20th century 7080's the building or expansion, equipment is relatively new. Hyundai, Samsung, Daewoo and so on into the shipbuilding industry consortium in the beginning to establish a clear goal, that is overtaking the world-class, create a world-class enterprise. Therefore, Korean companies are more large-scale shipbuilding facilities, and distribution-intensive; Japan is a focus on energy efficiency in the country, their duties clearly and medium-sized shipbuilding enterprises, which determines the Japanese, the proportion of medium-sized shipbuilding facilities relatively stable; look at China , since the 20th century, since the construction of a group of 90 major shipbuilding facilities, with the construction of a number of complex, technically difficult, high degree of automation of a large container ship hatch, LPG vessels, 15-ton bulk carrier. 300,000 tons class crude oil tankers and other ships with the international advanced level of construction capacity, but with South Korea, Japan is still a gap compared.
3 Comparison of shipbuilding output
According to statistics, in 2005 South Korea, Japan, China, completed three of the new ships is 9.7 million, respectively, CGT, 840 涓?CGT, 360 涓?CGT, respectively, completed the world's total accounts for 35.8%, 31.0% and 13.3%. It is predicted that completion of new ships in 2006 the world will continue to maintain a high level of volume, Korea's new ship completions will continue to lead the shipbuilding industry. Korea, Japan and China for new ships will be completed by volume share was 34.0%, 26.7% and 15.4%. Compared with previous years, China's share will be drastically increased, as shown in Table 4.




According to ISL, in 2005, South Korea, Japan, China, orders three new ships were 14.814 million CGT, 1061.0 涓?CGT and 8.925 million CGT. Compared with the previous two years, South Korea, Japan, orders fell significantly, and China's new ship orders volume continued steady growth, but the volume of orders and the ROK and Japan are still not small compared to the gap. As shown in table 5.
Table 6 Statistics of 20,002,006 for the ISL in Korea, Japan and China for holding the main ship orders. To January 1, 2006 statistics indicate that from the ship on the analysis, Korean-built tanker (including LNG ships, LPG vessels, etc.) and container ships have the clear edge, and Japan to the main bulk carriers and general cargo ships, China The ship's power distribution more uniform.
4 Comparison product structure
Shipyard's shipbuilding countries is reflected in the strength of specific types of vessels on which they built, that is, types of vessels built by the technical complexity increase reflects a national ship design, construction technology, high and low. The Government of Japan under the guidance of the shipyard, a large shipyard built large ships, medium build medium-sized shipyards ships, the establishment of a clear division of labor. Rising star of Korean and Japanese shipyards have roughly the same boat in a large shipyard built more than 70% of large vessels, while the medium-sized shipyards built ships more than 70% are medium-sized ships.
From the vessel type of view, the current South Korean tanker shipyard is the main product (including LNG ships. LPG ships, etc.) and large container ships; Japanese shipyards main products are bulk carriers and general cargo ships, and China were largely conventional construction of oil tankers, container ships and bulk carriers (Table 6).
From Korea, Japan and China Shipbuilding product complexity, such as Korea in conventional crude oil tankers, bulk carriers and container ships the lowest market share, while its LNG shipping vessels in the highest proportion of high complexity. Ships from generally reflect the complexity of the ship to amend the ratio of gross tonnage and deadweight of view (in Table 5 Statistics for 2005 to calculate a single new ship Ding), South Korea had the highest 0.48, slightly higher than the world average of 0.47, followed by Japan, was 0.36, slightly higher than China's 0.35.
In recent years, although the rapid development of China's shipbuilding industry have made remarkable achievements, but we should also see Korea and Japan compared to the advanced shipbuilding countries, there are still large gaps, mainly in the construction of its capacity and design level . To the 16 OECD Statistical Classification ship, currently our shipyard to design and build the basic capacity with only crude oil tankers, product tankers, chemical tankers, bulk carriers and container ships and other conventional ship, the refrigerator ship, large container ships, ro-ro ships, LNG ships and other ship design mainly depend on foreign countries. High-tech, high value-added vessels, such as large container ships, large LNG vessels with the ROK and Japan differ greatly from the current high value-added vessels such Korea, and Japan account for more than 70% share of the world, and our lack of 14% 0
5 Comparison of Shipbuilding Technology
Design technology, construction technology and management technology is integrated shipbuilding skills embodied in three different aspects, in recent years, South Korean experts on Korea, Japan and China Shipbuilding comprehensive technical assessment of the level of comparison, the results shown in Table 7.




As can be seen from the table design and management of technology is very weak link in China's shipyards. South Korean shipyard, compared with the Japanese shipyard, is also a big gap between these two aspects, which directly influences the efficiency of shipyard shipbuilding, which has caused the Korean shipbuilding industry attention.
6 Summary
For our shortcomings and weaknesses, for the realization of the world's No. 1 shipbuilding power in the grand goal, it is recommended:
* Focus on building a number of national shipbuilding base in support of a number of large-scale furniture are the backbone of the shipyard to become a world-class shipbuilding enterprise.
To become the world's No. 1 shipbuilding power, you must first shipbuilding capacity (in tonnage terms) as the world. States should increase financial input and support competitive large-scale shipyard to become the world's world-class shipyards, to speed up large berth (dock) based shipbuilding infrastructure investment, to achieve the geographical concentration of shipbuilding capacity, manufacturers focused for our country become the world's No. 1 shipbuilding power to create preconditions.
* Strengthening the management, learning from the advanced shipbuilding technology model to improve productivity, reduce material consumption.
According to a study by Japan's Hitachi Shipbuilding, Construction I ship VLCC, their employment in 1991 than in 1967 when the reduction of 71%, 10% and 12% came from technology methods and equipment improved, while 31% and from 1 $% management improvement and production patterns of improvement. Therefore, strengthening the management, use of advanced shipbuilding model is to improve production efficiency, an important way to reduce material consumption.
* Strengthening the capacity of ship research and design, develop high-tech ship
While China already has the world's three main ship design capability, and some even created a brand name, but the overall ship design of our forces are still weak, can not meet the needs of production development. Design level is not high, the design of products and higher cost, design cycle is long, technical reserves less, many high-tech ships can not design. Ship research, design, and increasing support, encourage high-tech research vessel, to improve the product structure. While strengthening the ability of marine computer software development, combined with business management, production processes, production equipment, the actual situation in software development or secondary development of digital technology shipbuilding.
* Accelerating the pace of shipbuilding force integration.
Speed up the integration of China's shipbuilding force the pace of change in China's shipbuilding industry in the production, marketing, procurement and R & D went their own ways on their own situation, forming several powerful business groups, and within the group of production, marketing, procurement and R & D integration. Main advantage of the shipyard should form their own products, the implementation of product focus, to facilitate the strengthening management, and explore the advanced shipbuilding mode, reducing costs and material consumption, improve labor productivity.
* Speed up the development of supporting industries upstream, downstream industries to stimulate demand for shipbuilding, give full play to the role of the shipbuilding industry linkage.
Increase the upstream ship machinery industry support and technological investment, improve the technical level of domestic marine equipment and competitiveness, improving domestic marine equipment, shipping rate, give full play to the manufacturing industry and the shipbuilding industry on the national economic development role. Meanwhile, the strong support of inland shipping and international shipping development, implementation, support and encourage "national round of the state to create" practice "cargo reservation" and "domestic products fortunes" policy, increase the demand on the shipbuilding industry pull.
* Increased government support efforts to give full play to the role of policy finance, and further increase support for the export of ships.
Looking at Korean, Japanese shipbuilding industry development experience, not without strong support from the government to develop. China's shipbuilding industry is inseparable from the development of the same policy under the government-led financial and export credit agencies support. Recommends that national export credit agencies to take appropriate measures to encourage increased localization rate of ships to improve the competitiveness of China's ship exports and increase support for large-scale infrastructure, expand the scale and intensity of the ship exports.
China's shipbuilding industry and the ROK and Japan compared to many aspects of the difference is quite large, but the gap is the space of our development, shorten the gap is our clear goals and power struggle. China's shipbuilding industry has its own advantages, but also very suitable for the development of China's national conditions and shipping industry. At present, China's shipbuilding industry has laid a big country to the shipbuilding, power forward a solid foundation, though from the distance we have still a long way to achieve the goal, the task is still arduous, but as long as we are ready to play to our strengths, to overcome the shortage, accelerate the development of In the new century, we firmly believe that we can make a difference. We have enough ability and belief that China's shipbuilding industry must be able to catch up with Korea, Japan, and eventually the world's No. 1 shipbuilding power ambitions.






相关链接:



Hot Multimedia CREATION Tools



choose the best satellite tv FOR pc software



Yuan established the value of win-win Connection



VOB to FLV



Simple Music Composers



Who is knocking the door of opportunity?



The implementation of EU environmental directives will rob the U.S. Green Certification in China



Digital China Open play The "Famous Brand" legal battle



PHOTOSHOP production-ray results



DV to AVI



"Staying Princess" Mercenary Information Finished



Qiu Bojun Believe Love At First Sight, No One Suggests



DAT To MPEG



"Batman Arkham asylum" after playing a little bit of getting



Specialist Dial Up And Connection Tools



Sunday, October 10, 2010

Comments: Haier bid for Maytag out of mountains and rivers to be epigenetic re-


This topic is not accurate or appropriate? I was somewhat hesitant. Haier bid for Maytag in all the worries and concerns when the draw is now finally a full stop of the. Mattel announced that Haier and its partners and the Blackstone Group has withdrawn BainCapital on Maytag bid.

Although experts say the withdrawal is wise Haier is a sign of maturity. But I guess, Haier is not willing to return losing so. After all, the road is an international firm to ruin Haier, Haier has only entered the world on the poor 200 million five hundred, Haier has always wanted to be able to walk the road of internationalization better, more solid number, which is trying to conduct international One of the reasons for bidding.

But now this idea has been temporarily grounded. Haier has too many worries and concerns, after all, it is not a private or joint-stock enterprise, it is a state-controlled enterprises. Haier worried about price, the complexity of integrating the two companies, and U.S. political opposition. As the bidding war for Maytag, Whirlpool added, prices rising, this is one of the reasons Haier withdrawal. When the purchase price than expected, the Haier certainly prudent to treat the.

Haier on the acquisition of great concern in U.S. political circles disturbed. The concern is that Chinese companies to acquire a landmark prospects for U.S. companies might arise. Haier also plans to implement aspects of the business concerned. The business plan ready to keep the United States and Thailand in the U.S. sales and distribution team, while the low-cost manufacturing shifted to China. However, the idea was well-organized trade union opposition to Mattel employees.

Gluing together the various factors, Haier's bid to create pressure and more and more, ultimately forcing Haier chose to give up. Although the bid for Haier to give up, but we also see the gradual maturation of Haier, the inappropriate timing of the next, rather than rush to make a choice, not as quietly observe, carefully screened, after all, the road of internationalization is not in this time . Haier's prudence is a kind of confidence in the future, a greater opportunity for accumulation.

Economic model of globalization has become a trend in the internationalization of Chinese enterprises has been extended on out here, either TCL or Lenovo have started to explore and try this. Their success and problems encountered are in fact many newcomers warning, strange path to success, but the best for them is the most successful.

As netizens said: Haier is undoubtedly a very good business. However, this kind of problem can not but seriously, Haier also need to hone. After all, he and Sony, Panasonic, Samsung, General Motors, Siemens and other companies in the world compared with a prevalence in the industry is still a "child." He continues to grow, he has to temper. Haier will choose to believe the road for the acquisition of international action series, only to find more suitable opportunities. In this way, Haier is just not possible to taste. Do not believe that we will wait and see.






Recommended links:



Casino And Gambling Report



3GP to AVI



Comparison Of CMM And CMMI



5 bills paid to foreign fixed up on the boss



Century AMD antitrust case of the hearing level to promote fair competition



Best Religion



error loading c windows System32 nvmctray dll



COMMENT Icons



DAT to WMV



WGA newest setting: It may be pirated



My favorite Helpdesk And Remote PC



Avocent growth in M & A



Intellectual property rights Is not instead of themselves



CEO? Does not change the financial style, the class!



ASF to AVI



Liu: Do Not Play Tricks To Play On The Capital