In terms of mathematics, modern computers are a specific implementation of "universal chartering". From philosophical, the behavior is inevitable based on computer-based computers. "For a determined input, its output is completely determined." Philosophers and science fiction writers unified views are: anyway, if not introduced uncertainty for the basic calculation model of the computer, artificial intelligence (AI) is impossible Really realized. However, like all other problems, when we consider "deterministic issues of computer behavior", we will draw different conclusions.
Usually when we only master a system (the philosophical concept of systemism, it is not a computer software or hardware system), the boundary of this subsystem is also uncertain. Modern computers are usually composed of a large number of different parts, each of which is the aforementioned subsystem, and their boundaries are loose, just a generally type boundary. To give an example: For example, we can get a certain size memory through a function, but we can't know the specific content saved in advance.
On the other hand, as a "advanced programming language", it is still a considerable gap on the expression ability of the machine underlayer, especially when a language is maintained in a "semantic" of a concept. The language through semantic expression is an abstraction for programmers, usually without direct corresponding machine underlayer mechanisms, but is simulated by complicated machine behavior. Language abstract semantics and faults of the machine underlayer mechanism will cause another form of uncertainty.
Finally, we must realize the sociality of the language itself. During the development of language, there is usually a different implementation given different behaviors. As a C language, it also includes many historical issues that have all been generated from the C language. For such different compilers, the concept of different interpretations and behaviors, the C standard policy is to reserve them to a specific compiler, and only possible C implementation behavior selection is given.
These uncertainty will naturally be taken to our program.
Some default behaviors supported by C language may be related to the geographic environment of the machine configuration. For example, language text, time zone, regional habits, etc. will affect the relevant behavior of the library provided by C . These behaviors are often uncertain about the procedure. Programmers should write international / localized procedures, always deal with this information.
C standards are clearly defined:
1.3.14 Well-Formed Program [Defns.well.FORMED]
A C Program Construction According to the Syntax Rules, Diagnosable Semantic Rules, And The One Definition Rule (3.2). "Complete C Program" follows C syntax rules, diagnosed semantic rules, and "one definition principle (ODR)" .
1.3.4 ill-factoryd program [defns.ill.formed]
INPUT TO A C Implementation That Is Not A Well-Formed Program (1.3.14). For C implementations, "morbid C programs" is a text input other than "Complete C Programs".
1.3.12 undefined behavior [defns.undefined]
behavior, such as might arise upon use of an erroneous program construct or erroneous data, for which this International Standard imposes no requirements Undefined behavior may also be expected when this International Standard omits the description of any explicit definition of behavior [Note:.. permissible undefined behavior ranges from ignoring the situation completely with unpredictable result, to behaving during translation or program execution in a documented manner characteristic of the environment (with or without the issuance of a diagnostic message), to terminating a translation or execution (with the issuance of A Diagnostic Message). Many Erroneous Program Constructs Do Not Engender Undefined Behavior; The error programming and data will result in "undefined behavior", these programs are not formulated. When the C standard omission describes any behavior with obvious definitions, "undefined behavior" is also caused. [Note: Additional undefined behaviors include complete ignore the situation that generates uncertain results, or generates the environment unique, a document description (may also issue a diagnostic message), or directly terminated or executed directly (And publish diagnostic messages). Many erroneous programming will not cause undefined behavior, such programs need to be diagnosed. 】 1.3.13 Unspecified Behavior [Defns.unspecified]
. Behavior, for a well-formed program construct and correct data, that depends on the implementation The implementation is not required to document which behavior occurs. [Note: usually, the range of possible behaviors is delineated by this International Standard.] From the complete The program constructor and the correct data generated are called "unmetive behavior". C implementation does not need to provide documents for these behaviors. [Note: C standards usually list possible scope of behavior. 】
1.3.5 Implementation-Defined Behavior [Defns.Impl.defined]
Behavior, for A Well-Formed Program Construct and Correct Data, That Depends on The Implementation and That Each Implementation SHALL Document. Some of the fully implemented behavior generated by the complete programming, called "by Behavior of implementation, C standard requires each implementation to provide document descriptions for these behaviors. 1.3.7 Locale-Specific Behavior [Defns.Locale.Specific]
Behavior That Depends On Local Conventions of nationality, Culture, And Language That Each Implementation Shall Document. Relying on local country, cultural and language habits, known as "on-site behavior", C standard requires every implementation Document descriptions are provided for these behaviors.
A beginners of C often ask some questions that seem to "professional", such as int i = 5; int J = ( i) ( i) ( i); or int A, int A, int b); int i = 5; f ( i, i); this problem does not need to be considered, and should be avoided in actual programming practice. Because they are almost all "unmetive behavior" or "behavior defined by implementation." On the other hand, the error or BUGS of the program is usually due to "undefined behavior."