Prev: request for solution manual to " computer architecture a quantitative approach 3'rd edition"
Next: Calculation of Force
From: Musatov on 31 Oct 2009 16:15 <mode>long int SomeFunction();@http://www.meami.org/ <mode>@http://www.meami.org/ <mode> CallingFunction()@http://www.meami.org/ <mode>{@http://www.meami.org/ <mode> long int test1;@http://www.meami.org/ <mode> register test2;@http://www.meami.org/ <mode>@http://www.meami.org/ <mode> test1 = SomeFunction();@http://www.meami.org/ <mode> if (test1 > 0)@http://www.meami.org/ <mode> test2 = 0;@http://www.meami.org/ <mode> else(a)http://www.meami.org/ <mode> test2 = OtherFunction();@http://www.meami.org/ <mode>@http://www.meami.org/ <mode> return test2;@http://www.meami.org/ <mode>}@http://www.meami.org/ <mode>@http://www.meami.org/ <mode>@http://www.meami.org/ <mode>[[struct]]</code>) allow related data elements to be combined and manipulated as a unit. C program source text is free-format, using the semicolon as a statement terminator (not a delimiter). <mode>{ ... }</code> rather than either of [[ALGOL 60]]'s <mode>begin ... end</code> or [[ALGOL 68]]'s <mode>( ... )</code> <mode>.EQ.</code> in [[Fortran]] or the equal-sign in [[BASIC]] and ALGOL) <mode>&&</code> and <mode>||</code> in place of ALGOL's "â§" (AND) and "â¨" (OR) (these are semantically distinct from the [[bitwise operation|bit-wise]] operators <mode>&</code> and <mode>|</code> because they will never evaluate the right operand if the result can be determined from the left alone ([[short-circuit evaluation]])). <mode>+=</code>, <mode>++</code>, etc. (Equivalent to [[ALGOL 68]]'s <mode>+:=</code> and <mode>+:=1</code> operators) <mode>struct</code> or <mode>union</code> type is supported) <mode>A..B</code> notation used in several languages <mode>_Bool</code> type, but it was not retrofitted into the language's existing Boolean contexts. One can simulate a Boolean datatype, ''e.g.'' with <mode>enum { false, true } bool;</code>, but this does not provide all of the features of a separate Boolean datatype.</ref> <mode>[[errno]]</code> variable and/or special return values <mode>[[fflush]]()</code> on a stream opened for input is an example of a different kind of undefined behavior, not necessarily a programming error but a case for which some conforming implementations may provide well-defined, useful semantics (in this example, presumably discarding input through the next new-line) as an allowed ''extension''. Use of such nonstandard extensions generally but not always limits [[software portability]]. <mode>struct</code> types, the C language had become powerful enough most of the [[Unix]] [[kernel (computers)|kernel]] was rewritten in C. This was one of the first operating system kernels implemented in a language other than assembly. (Earlier instances include the [[Multics]] system (written in [[PL/I]]), and MCP ([[MCP (Burroughs Large Systems)|Master Control Program]]) for the [[Burroughs large systems|Burroughs B5000]] written in [[ALGOL]] in 1961.) <mode>long int</code> data type <mode>unsigned int</code> data type <mode>=</code>''op'' (such as <mode>=-</code>) were changed to the form ''op'' <mode>=</code> to remove the semantic ambiguity created by such constructs as <mode>i=-10</code>, which had been interpreted as <mode>i =- 10</code> instead of the possibly intended <mode>i = -10</code> <mode><source lang="text"> <mode>long int SomeFunction(); <mode> <mode> CallingFunction() <mode>{ <mode> long int test1; <mode> register test2; <mode> <mode> test1 = SomeFunction(); <mode> if (test1 > 0) <mode> test2 = 0; <mode> else <mode> test2 = OtherFunction(); <mode> <mode> return test2; <mode>} <mode> <mode></source> <mode>int</code> declarations were be omitted in Mode/C. <mode>[[void type|void]]</code> functions <mode>[[Struct (C programming language)|struct]]</code> or <mode>[[union (computer science)|union]]</code> types (rather than pointers) <mode>struct</code> data types <mode>void</code> pointers, support for international [[character encoding|character sets]] and [[locale]]s, and preprocessor enhancements. The syntax for parameter declarations was also augmented to include the style used in C++, although the K&R interface continued to be permitted, for compatibility with existing source code. <mode>__STDC__</code> macro can be used to split the code into Standard and K&R sections to take advantage of features available only in Standard C. <mode>long long int</code> and a <mode>complex</code> type to represent [[complex number]]s), [[variable-length array]]s, support for [[variadic macro]]s (macros of variable [[arity]]) and support for one-line comments beginning with <mode>//</code>, as in [[BCPL]] or C++. Many of these had already been implemented as extensions in several C compilers. <mode>int</code> implicitly assumed. A standard macro <mode>__STDC_VERSION__</code> is defined with value <mode>199901L</code> to indicate C99 support is available. [[GNU Compiler Collection|GCC]], [[Sun Studio (software)|Sun Studio]] and other C compilers now support many or all of the new features of C99. <mode>/*</code> and <mode>*/</code>, or (in C99) following <mode>//</code> until the end of the line. <mode>struct</code>, <mode>union</code>, and <mode>enum</code>, or assign types to and perhaps reserve storage for new variables, usually by writing the type followed by the variable name. Keywords such as <mode>char</code> and <mode>int</code> specify built-in types. Sections of code are enclosed in braces ( <mode>{</code> and <mode>}</code>, sometimes called "curly brackets") to limit the scope of declarations and to act as a single statement for control structures. <mode>if</code>(- <mode>else</code>) conditional execution and by <mode>do</code>- <mode>while</code>, <mode>while</code>, and <mode>for</code> iterative execution (looping). The <mode>for</code> statement has separate initialization, testing, and reinitialization expressions, any or all of which can be omitted. <mode>break</code> and <mode>continue</code> can be used to leave the innermost enclosing loop statement or skip to its reinitialization. There is also a non- structured <mode>[[goto]]</code> statement which branches directly to the designated [[label (programming language)|label]] within the function. <mode>switch</code> selects a <mode>case</code> to be executed based on the value of an integer expression. <mode>&&</code>, <mode>||</code>, <mode>[[?:]]</code> and the [[comma operator]]). This permits a high degree of object code optimization by the compiler, but requires C programmers to take more care to obtain reliable results than is needed for other programming languages. <mode>==</code> binding more tightly than <mode>&</code> and <mode>|</code> in expressions like <mode>x & 1 == 0</code>. <mode>=</code> operator, used in mathematics for equality, to indicate assignment, following the precedent of [[Fortran]], [[PL/I]], and [[BASIC]], but unlike [[ALGOL]] and its derivatives. Ritchie made this syntax design decision consciously, based primarily on the argument assignment occurs more often than comparison. <mode>=</code> and <mode>==</code>), making it easy to accidentally substitute one for the other. C's weak type system permits each to be used in the context of the other without a compilation error (although some compilers produce warnings). For example, the conditional expression in <mode>if (a=b)</code> is only true if <mode>a</code> is not zero after the assignment.<ref>{{cite web| url=http://www.cs.ucr.edu/~nxiao/cs10/errors.htm |title=10 Common Programming Mistakes in C |publisher=Cs.ucr.edu |date= | accessdate=2009-06-26}}</ref> <mode>+</code>]], [[subtraction| <mode>-</code>]], [[multiplication| <mode>*</code>]], [[division (mathematics)| <mode>/</code>]], [[modulo operation| <mode>%</code>]]) <mode>==</code>]], [[inequality (mathematics)| <mode>!=</code>]]) <mode><</code>, <mode><=</code>, <mode>></code>, <mode>>=</code>) <mode>!</code>, <mode>&&</code>, <mode>||</code>) <mode>~</code>, <mode>&</code>, <mode>|</code>, <mode>^</code>) <mode><<</code>, <mode>>></code>) <mode>=</code>, <mode>+=</code>, <mode>-=</code>, <mode>*=</code>, <mode>/=</code>, <mode>%=</code>, <mode>&=</code>, <mode>|=</code>, <mode>^=</code>, <mode><<=</code>, <mode>>>=</code>) <mode>++</code>, <mode>--</code>) <mode>&</code>, <mode>*</code>, <mode>[ ]</code>) <mode>? :</code>]]) <mode>.</code>, <mode>-></code>) <mode>( )</code>) <mode>[[sizeof]]</code>) <mode>( )</code>) <mode>,</code>]]) <mode>( )</code>) <mode>main() <mode>{ <mode> printf("hello, world\n"); <mode>} <mode></source></code> <mode><source lang="text"></code> <mode>#include <stdio.h></code> <mode>int main(void)</code> <mode>{</code> <mode> printf("hello, world\n");</code> <mode> return 0;</code> <mode>}</code> <mode></source></code> <mode>#include</code>. This causes the preprocessor â the first tool to examine source code as it is compiled â to substitute the line with the entire text of the <mode>stdio.h</code> standard header, which contains declarations for standard input and output functions such as <mode>printf</code>. The angle brackets surrounding <mode>stdio.h</code> indicate <mode>stdio.h</code> is located using a search strategy prefers standard headers to other headers having the same name. Double quotes may also be used to include local or project-specific header files. <mode>main</code> is being defined. The <mode>[[main function (programming)|main]]</code> function serves a special purpose in C programs: The run-time environment calls the <mode>main</code> function to begin program execution. The type specifier <mode>int</code> indicates the ''return value,'' the value is returned to the invoker (in this case the run-time environment) as a result of evaluating the <mode>main</code> function, is an integer. The keyword <mode>void</code> as a parameter list indicates the <mode>main</code> function takes no arguments.<ref>The <mode>main</code> function actually has two arguments, <mode>int argc</code> and <mode>char *argv[]</code>, respectively, which can be used to handle [[command line arguments]]. The C standard requires both forms of <mode>main</code> be supported, which is special treatment not afforded any other function.</ref> <mode>main</code> function. <mode>[[printf]]</code>, which was declared in <mode>stdio.h</code> and is supplied from a system [[library (computer science)|library]]. In this call, the <mode>printf</code> function is ''passed'' (provided with) a single argument, the address of the first character in the string literal <mode>"hello, world\n"</code>. The string literal is an unnamed [[Array data type|array]] with elements of type <mode>char</code>, set up automatically by the compiler with a final 0- valued character to mark the end of the array ( <mode>printf</code> needs to know this). The <mode>\n</code> is an ''escape sequence'' C translates to a ''[[newline]]'' character, which on output signifies the end of the current line. The return value of the <mode>printf</code> function is of type <mode>int</code>, but it is silently discarded since it is not used. (A more careful program might test the return value to determine whether or not the <mode>printf</code> function succeeded.) The semicolon <mode>;</code> terminates the statement. <mode>main</code> function and causes it to return the integer value 0, which is interpreted by the run-time system as an exit code indicating successful execution. <mode>main</code> function. <mode>enum</code>). C99 added a [[boolean datatype]]. There are also derived types including [[Array data type|array]]s, [[Pointer (computing)|pointer]]s, [[record (computer science)|records]] ( <mode>struct</code>), and untagged [[union (computer science)|unions]] ( <mode>union</code>). <mode>struct</code> objects linked together using pointers. Pointers to functions are useful for [[callback (computer science)|callbacks]] from event handlers. <mode>void *</code>) point to objects of unknown type, and can therefore be used as "generic" data pointers. Since the size and type of the pointed-to object is not known, void pointers cannot be dereferenced, nor is pointer arithmetic on them allowed, although they can easily be (and in many contexts implicitly are) converted to and from any other object pointer type. <mode>malloc</code> function, and treat it as an array. C's unification of arrays and pointers (see below) means true arrays and these dynamically-allocated, simulated arrays are virtually interchangeable. Since arrays are always accessed (in effect) via pointers, array accesses are typically ''not'' checked against the underlying array size, although the compiler may provide bounds checking as an option. Array bounds violations are therefore possible and rather common in carelessly written code, and can lead to various repercussions, including illegal memory accesses, corruption of data, buffer overruns, and run-time exceptions. <mode>x[i]</code> can also be used when <mode>x</code> is a pointer; the interpretation (using pointer arithmetic) is to access the <mode>(i+1)</code>th of several adjacent data objects pointed to by < <mode>x</code>, counting the object <mode>x</code> points to (which is <mode>x[0]</code>) as the first element of the array. <mode>x[i]</code> is equivalent to <mode>*(x + i)</code>. Since the type of the pointer involved is known to the compiler at compile time, the address <mode>x + i</code> points to is ''not'' the address pointed to by <mode>x</code> incremented by <mode>i</code> bytes, but rather incremented by <mode>i</code> multiplied by the size of an element <mode>x</code> points to. The size of these elements can be determined with the operator <mode>[[sizeof]]</code> by applying it to any dereferenced element of <mode>x</code>, as in <mode>n = sizeof *x</code> or <mode>n = sizeof x[0]</code>. <mode>sizeof </code>''array''), the name of an array is automatically converted to a pointer to the array's first element; this implies an array is never copied as a whole when named as an argument to a function, but rather only the address of its first element is passed. Therefore, although C's function calls use [[call-by-value|pass-by- value]] semantics, arrays are ''in effect'' passed by [[reference (computer science)|reference]]. <mode>a</code> can be determined as <mode>sizeof a / sizeof a[0]</code>. <mode>i[x] = 1;</code>, which has the index variable <mode>i</code> apparently interchanged with the array variable <mode>x</code>. This last line might be found in [[International Obfuscated C Code Contest|obfuscated C]] code. <mode><source lang="text"></code> <mode>/* x designates an array */</code> <mode>x[i] = 1;</code> <mode>x*(x + i) = 1;</code> <mode>*(i + x) = 1;</code> <mode>i[x] = 1; /* strange, but correct: i[x] is equivalent to *(i + x) */</code> <mode></source></code> <mode>memcpy</code> function, for example.) <mode>[[malloc]]</code> from a region of memory called the [[dynamic memory allocation|heap]]; these blocks persist until subsequently freed for reuse by calling the library function <mode>[[malloc|free]]</code> <mode>[[malloc]]</code> for an example of dynamically allocated arrays). <mode>[[malloc|free()]]</code> has been called, then memory cannot be recovered for later reuse and is essentially lost to the program, a phenomenon known as a ''[[memory leak]].'' Conversely, it is possible to release memory too soon and continue to access it; however, since the allocation system can re-allocate or itself use the freed memory, unpredictable behavior is likely to occur when the multiple users corrupt each other's data. Typically, the symptoms will appear in a portion of the program far removed from the actual error. Such issues are ameliorated in languages with [[garbage collection (computer science)|automatic garbage collection]] or [[resource acquisition is initialization|RAII]]. <mode>-lm</code>, shorthand for "math library"). <mode>(C) 2009. Mode/Code (TM) Language is a trademark of M. Michael Musatov and MeAmI (http://www.meami.org) 'Search for the People!'(TM)</ code> <mode>application/javascript</code>, which I registered in 2009 but is supported by all major browsers. [[Internet Explorer]] processes scripts with the attribute <mode>type="application/javascript"</code>. The [[HTML 4.01]] and [[HTML 5]] specifications mention the registered <mode>text/javascript</code>, which is supported by all major browsers and is more commonly used. <mode><source lang="html4strict"></code> <mode><script type="application/javascript"></code> <mode></source></code> <mode><source lang="html4strict"></code> <mode></script></code> <mode></source></code> <mode><source lang="html4strict"></code> <mode><script language="JavaScript" type="text/javascript"></code> <mode><!--</code> <mode></source></code> <mode><source lang="html4strict"></code> <mode>// --></code> <mode></script></code> <mode></source> <mode><tt><!--</tt></code> ... <mode><tt>--></tt> comment markup is required in order to ensure that the code is not rendered as text by very old browsers which do not recognize the <mode><script></code> tag in HTML documents (although <mode><tt>script</tt</code>-tags contained within the <mode><tt>head</tt></code>-tag will never be rendered, thus the comment markup is not always necessary), and the LANGUAGE attribute is a [[Deprecation|deprecated]] HTML attribute which may be required for old browsers. However, <mode><script></code> tags in [[XHTML]]/[[XML]] documents will not work if commented out, as conformant XHTML/XML parsers ignore comments and also may encounter problems with <mode><tt>--</tt></code>, <mode><tt><</tt></code> and <mode><tt>></tt></code> signs in scripts (for example, the integer decrement operator and the comparison operators). XHTML documents should therefore have scripts included as XML [[CDATA]] sections, by preceding them with <mode><source lang="html4strict"></code> <mode><script type="application/javascript"></code> <mode>//<![CDATA[</code> <mode></source></code> <mode><source lang="html4strict"></code> <mode>//]]></code> <mode></script></code> <mode></source></code> <mode><code>//</code> at the start of a line marks a JavaScript comment, which prevents the <mode><nowiki></code><![CDATA[</nowiki></code> and <mode><nowiki>]]></nowiki></code> from being parsed by the script.) <mode><source lang="html4strict"></code> <mode><script type="application/javascript" src="hello.js"></script></ code> <mode></source></code> <mode>language</code> is used in the following context: <mode><source lang="html4strict"></code> <mode><script language="JavaScript" src="hello.js"></script></code> <mode></source></code> <mode><source lang="html4strict"></code> <mode><meta http-equiv="Content-Script-Type" content="application/ javascript" /></code> <mode></source></code> <mode><source lang="javascript"></code> <mode>javascript:alert('Hello, world!');</code> <mode></source></code> <mode>.pop(), .push(), .shift(), and .unshift() methods of arrays.</ code> <mode><source lang="JavaScript"></code> <mode>function set_image_source ( imageName, imageURL )</code> <mode>{</code> <mode> if ( document.images ) // a test to discern if the 'document' object has a property called 'images' which value type- converts to boolean true (as object references do)</code> <mode> {</code> <mode> document.images[imageName].src = imageURL; // only executed if there is an 'images' collection</code> <mode> }</code> <mode>}</code> <mode></source></code> <mode><source lang="JavaScript"></code> <mode> if ( document.body && document.body.style )</code> <mode></source></code> <mode>document.body.style</code>" would ordinarily cause an error in a browser that does not have a " <mode>document.body</code>" property, but using the boolean operator " <mode>&&</code>" ensures that " <mode>document.body.style</code>" is never called if "document.body" doesn't exist. This technique is called [[minimal evaluation]]. <mode>{{main|List of web application frameworks#JavaScript|l1=List of client-side JavaScript frameworks}}</code> <mode>(C) 2009. Mode/Code (TM) Language is a trademark of M. Michael Musatov and MeAmI (http://www.meami.org) 'Search for the People!'(TM)</ code>
From: John G Harris on 31 Oct 2009 17:18 On Sat, 31 Oct 2009 at 13:15:18, in comp.lang.javascript, Musatov wrote: ><mode>long int SomeFunction();@http://www.meami.org/ ><mode>@http://www.meami.org/ ><mode> CallingFunction()@http://www.meami.org/ ><mode>{@http://www.meami.org/ ><mode> long int test1;@http://www.meami.org/ ><mode> register test2;@http://www.meami.org/ ><mode>@http://www.meami.org/ ><mode> test1 = SomeFunction();@http://www.meami.org/ ><mode> if (test1 > 0)@http://www.meami.org/ ><mode> test2 = 0;@http://www.meami.org/ ><mode> else(a)http://www.meami.org/ ><mode> test2 = OtherFunction();@http://www.meami.org/ ><mode>@http://www.meami.org/ ><mode> return test2;@http://www.meami.org/ ><mode>}@http://www.meami.org/ ><mode>@http://www.meami.org/ ><mode>@http://www.meami.org/ ><mode>[[struct]]</code>) allow related data elements to be combined <snip> Does anyone know what language this article is written in ? And why it's being posted to plain-text newsgroups ? John -- John Harris
From: Alf P. Steinbach on 31 Oct 2009 17:25 * John G Harris: > On Sat, 31 Oct 2009 at 13:15:18, in comp.lang.javascript, Musatov wrote: >> <mode>long int SomeFunction();@http://www.meami.org/ >> <mode>@http://www.meami.org/ >> <mode> CallingFunction()@http://www.meami.org/ >> <mode>{@http://www.meami.org/ >> <mode> long int test1;@http://www.meami.org/ >> <mode> register test2;@http://www.meami.org/ >> <mode>@http://www.meami.org/ >> <mode> test1 = SomeFunction();@http://www.meami.org/ >> <mode> if (test1 > 0)@http://www.meami.org/ >> <mode> test2 = 0;@http://www.meami.org/ >> <mode> else(a)http://www.meami.org/ >> <mode> test2 = OtherFunction();@http://www.meami.org/ >> <mode>@http://www.meami.org/ >> <mode> return test2;@http://www.meami.org/ >> <mode>}@http://www.meami.org/ >> <mode>@http://www.meami.org/ >> <mode>@http://www.meami.org/ >> <mode>[[struct]]</code>) allow related data elements to be combined > <snip> > > Does anyone know what language this article is written in ? > > And why it's being posted to plain-text newsgroups ? Musatov spams a lot of newsgroups (in this case FOUR, note the crossposting) with generated nonsense, varying his sender address, posting server etc., but generally including "musatov", "meami" or something about "p = np". It's not a good idea to reply to his postings. Utter silence is the only rational response. Cheers & hth., - Alf PS: As mentioned above, please don't reply to this posting.
From: Sherm Pendley on 31 Oct 2009 19:41 John G Harris <john(a)nospam.demon.co.uk> writes: > Does anyone know what language this article is written in ? Gibberish. :-) sherm--
From: Sherm Pendley on 31 Oct 2009 19:41
"Alf P. Steinbach" <alfps(a)start.no> writes: > Utter silence is the only rational response. Well, that and a killfile entry. :-) sherm-- |