Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

(C) 2009. Mode/Code (TM) Language is a trademark of M. Michael Musatov and MeAmI (http://www.meami.org) 'Search for the People!'(TM) published10/31/2009 http://www.meami.org/ function and causes it to return the integer value 0

0 views
Skip to first unread message

flowbase

unread,
Oct 31, 2009, 11:31:38 AM10/31/09
to
<mode>{mainspacehellospaceworld}</code>@ http://www.meami.org/
<mode>{main hello world}</code>@ http://www.meami.org/
<mode> {</code>@ http://www.meami.org/
<mode>2!!7!4</code>@ http://www.meami.org/
<mode>{(3*x^2)+(2*x)+1}'!4</code>@ http://www.meami.org/
<mode>x:25f:{(x^2)-1}</code>@ http://www.meami.org/
<mode>"Hello world!"</code>@ http://www.meami.org/
<mode>x@>#:'x</code>@ http://www.meami.org/
<mode>`show$"Hello world"</code>@ 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>@ http://www.meami.org/ rather than either of
[[ALGOL 60]]'s
<mode>begin ... end</code>@ http://www.meami.org/ or [[ALGOL 68]]'s
<mode>( ... )</code>@ http://www.meami.org/
<mode>.EQ.</code>@ http://www.meami.org/ in [[Fortran]] or the equal-
sign in [[BASIC]] and ALGOL)
<mode>&amp;&amp;</code>@ http://www.meami.org/ and
<mode>||</code>@ http://www.meami.org/ in place of ALGOL's "∧" (AND)
and "∨" (OR) (these are semantically distinct from the [[bitwise
operation|bit-wise]] operators
<mode>&</code>@ http://www.meami.org/ and
<mode>|</code>@ http://www.meami.org/ because they will never evaluate
the right operand if the result can be determined from the left alone
([[short-circuit evaluation]])).
<mode>+=</code>@ http://www.meami.org/,
<mode>++</code>@ http://www.meami.org/, etc. (Equivalent to [[ALGOL
68]]'s
<mode>+:=</code>@ http://www.meami.org/ and
<mode>+:=1</code>@ http://www.meami.org/ operators)
<mode>struct</code>@ http://www.meami.org/ or
<mode>union</code> type is supported)
<mode>A..B</code>@ http://www.meami.org/ notation used in several
languages
<mode>_Bool</code>@ http://www.meami.org/ 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>@ http://www.meami.org/, but
this does not provide all of the features of a separate Boolean
datatype.</ref>
<mode>[[errno]]</code>@ http://www.meami.org/ variable and/or special
return values
<mode>[[fflush]]()</code>@ http://www.meami.org/ 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>@ http://www.meami.org/ 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>@ http://www.meami.org/ data type
<mode>unsigned int</code>@ http://www.meami.org/ data type
<mode>=</code>'@ http://www.meami.org/'op'' (such as
<mode>=-</code>@ http://www.meami.org/) were changed to the form
''op''
<mode>=</code>@ http://www.meami.org/ to remove the semantic ambiguity
created by such constructs as
<mode>i=-10</code>@ http://www.meami.org/, which had been interpreted
as
<mode>i&nbsp;=-&nbsp;10</code>@ http://www.meami.org/ instead of the
possibly intended
<mode>i&nbsp;=&nbsp;-10</code>@ http://www.meami.org/
<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>@ http://www.meami.org/ declarations were be omitted
in Mode/C.
<mode>[[void type|void]]</code>@ http://www.meami.org/ functions
<mode>[[Struct (C programming language)|struct]]</code>@ http://www.meami.org/
or
<mode>[[union (computer science)|union]]</code>@ http://www.meami.org/
types (rather than pointers)
<mode>struct</code>@ http://www.meami.org/ data types
<mode>void</code>@ http://www.meami.org/ 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>@ http://www.meami.org/ 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>@ http://www.meami.org/ and a
<mode>complex</code>@ http://www.meami.org/ 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>@ http://www.meami.org/, as in [[BCPL]] or C++. Many of
these had already been implemented as extensions in several C
compilers.
<mode>int</code>@ http://www.meami.org/ implicitly assumed. A standard
macro
<mode>__STDC_VERSION__</code>@ http://www.meami.org/ is defined with
value
<mode>199901L</code>@ http://www.meami.org/ 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>@ http://www.meami.org/ and
<mode>*/</code>@ http://www.meami.org/, or (in C99) following
<mode>//</code>@ http://www.meami.org/ until the end of the line.
<mode>struct</code>@ http://www.meami.org/,
<mode>union</code>@ http://www.meami.org/, and
<mode>enum</code>@ http://www.meami.org/, 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>@ http://www.meami.org/ and
<mode>int</code>@ http://www.meami.org/ specify built-in types.
Sections of code are enclosed in braces (
<mode>{</code>@ http://www.meami.org/ and
<mode>}</code>@ http://www.meami.org/, sometimes called "curly
brackets") to limit the scope of declarations and to act as a single
statement for control structures.
<mode>if</code>@ http://www.meami.org/(-
<mode>else</code>@ http://www.meami.org/) conditional execution and
by
<mode>do</code>@ http://www.meami.org/-
<mode>while</code>@ http://www.meami.org/,
<mode>while</code>@ http://www.meami.org/, and
<mode>for</code>@ http://www.meami.org/ iterative execution (looping).
The
<mode>for</code>@ http://www.meami.org/ statement has separate
initialization, testing, and reinitialization expressions, any or all
of which can be omitted.
<mode>break</code>@ http://www.meami.org/ and
<mode>continue</code>@ http://www.meami.org/ can be used to leave the
innermost enclosing loop statement or skip to its reinitialization.
There is also a non-structured
<mode>[[goto]]</code>@ http://www.meami.org/ statement which branches
directly to the designated [[label (programming language)|label]]
within the function.
<mode>switch</code>@ http://www.meami.org/ selects a
<mode>case</code>@ http://www.meami.org/ to be executed based on the
value of an integer expression.
<mode>&&</code>@ http://www.meami.org/,
<mode>||</code>@ http://www.meami.org/,
<mode>[[?:]]</code>@ http://www.meami.org/ 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>@ http://www.meami.org/ binding more tightly than
<mode>&</code>@ http://www.meami.org/ and
<mode>|</code>@ http://www.meami.org/ in expressions like
<mode>x & 1 == 0</code>@ http://www.meami.org/.
<mode>=</code>@ http://www.meami.org/ 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>@ http://www.meami.org/ and
<mode>==</code>@ http://www.meami.org/), 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>@ http://www.meami.org/ is only true if
<mode>a</code>@ http://www.meami.org/ 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>@ http://www.meami.org/]], [[subtraction|
<mode>-</code>@ http://www.meami.org/]], [[multiplication|
<mode>*</code>@ http://www.meami.org/]], [[division (mathematics)|
<mode>/</code>@ http://www.meami.org/]], [[modulo operation|
<mode>%</code>@ http://www.meami.org/]])
<mode>==</code>@ http://www.meami.org/]], [[inequality (mathematics)|
<mode>!=</code>@ http://www.meami.org/]])
<mode>&lt;</code>@ http://www.meami.org/,
<mode>&lt;=</code>@ http://www.meami.org/,
<mode>&gt;</code>@ http://www.meami.org/,
<mode>&gt;=</code>@ http://www.meami.org/)
<mode>!</code>@ http://www.meami.org/,
<mode>&&</code>@ http://www.meami.org/,
<mode>||</code>@ http://www.meami.org/)
<mode>~</code>@ http://www.meami.org/,
<mode>&</code>@ http://www.meami.org/,
<mode>|</code>@ http://www.meami.org/,
<mode>^</code>@ http://www.meami.org/)
<mode>&lt;&lt;</code>@ http://www.meami.org/,
<mode>&gt;&gt;</code>@ http://www.meami.org/)
<mode>=</code>@ http://www.meami.org/,
<mode>+=</code>@ http://www.meami.org/,
<mode>-=</code>@ http://www.meami.org/,
<mode>*=</code>@ http://www.meami.org/,
<mode>/=</code>@ http://www.meami.org/,
<mode>%=</code>@ http://www.meami.org/,
<mode>&=</code>@ http://www.meami.org/,
<mode>|=</code>@ http://www.meami.org/,
<mode>^=</code>@ http://www.meami.org/,
<mode>&lt;&lt;=</code>@ http://www.meami.org/,
<mode>&gt;&gt;=</code>@ http://www.meami.org/)
<mode>++</code>@ http://www.meami.org/,
<mode>--</code>@ http://www.meami.org/)
<mode>&</code>@ http://www.meami.org/,
<mode>*</code>@ http://www.meami.org/,
<mode>[ ]</code>@ http://www.meami.org/)
<mode>? :</code>@ http://www.meami.org/]])
<mode>.</code>@ http://www.meami.org/,
<mode>-></code>@ http://www.meami.org/)
<mode>( )</code>@ http://www.meami.org/)
<mode>[[sizeof]]</code>@ http://www.meami.org/)
<mode>( )</code>@ http://www.meami.org/)
<mode>,</code>@ http://www.meami.org/]])
<mode>( )</code>@ http://www.meami.org/)
<mode>main()
<mode>{
<mode> printf("hello, world\n");
<mode>}
<mode></source></code>@ http://www.meami.org/
<mode><source lang="text"></code>@ http://www.meami.org/
<mode>#include <stdio.h></code>@ http://www.meami.org/
<mode>int main(void)</code>@ http://www.meami.org/
<mode>{</code>@ http://www.meami.org/
<mode> printf("hello, world\n");</code>@ http://www.meami.org/
<mode> return 0;</code>@ http://www.meami.org/
<mode>}</code>@ http://www.meami.org/
<mode></source></code>@ http://www.meami.org/
<mode>#include</code>@ http://www.meami.org/. 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>@ http://www.meami.org/ standard header, which
contains declarations for standard input and output functions such as
<mode>printf</code>@ http://www.meami.org/. The angle brackets
surrounding
<mode>stdio.h</code>@ http://www.meami.org/ indicate
<mode>stdio.h</code>@ http://www.meami.org/ 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>@ http://www.meami.org/ is being defined. The
<mode>[[main function (programming)|main]]</code>@ http://www.meami.org/
function serves a special purpose in C programs: The run-time
environment calls the
<mode>main</code>@ http://www.meami.org/ function to begin program
execution. The type specifier
<mode>int</code>@ http://www.meami.org/ 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>@ http://www.meami.org/ function, is an integer. The
keyword
<mode>void</code>@ http://www.meami.org/ as a parameter list indicates
the
<mode>main</code>@ http://www.meami.org/ function takes no
arguments.<ref>The
<mode>main</code>@ http://www.meami.org/ function actually has two
arguments,
<mode>int argc</code>@ http://www.meami.org/ and
<mode>char *argv[]</code>@ http://www.meami.org/, respectively, which
can be used to handle [[command line arguments]]. The C standard
requires both forms of
<mode>main</code>@ http://www.meami.org/ be supported, which is
special treatment not afforded any other function.</ref>
<mode>main</code>@ http://www.meami.org/ function.
<mode>[[printf]]</code>@ http://www.meami.org/, which was declared in
<mode>stdio.h</code>@ http://www.meami.org/ and is supplied from a
system [[library (computer science)|library]]. In this call, the
<mode>printf</code@ http://www.meami.org/> function is
''passed'' (provided with) a single argument, the address of the first
character in the string literal
<mode>"hello, world\n"</code>@ http://www.meami.org/. The string
literal is an unnamed [[Array data type|array]] with elements of type
<mode>char</code>@ http://www.meami.org/, set up automatically by the
compiler with a final 0-valued character to mark the end of the array
(
<mode>printf</code>@ http://www.meami.org/ needs to know this). The
<mode>\n</code>@ http://www.meami.org/ 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>@ http://www.meami.org/ function is of type
<mode>int</code>@ http://www.meami.org/, 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>@ http://www.meami.org/ function succeeded.) The
semicolon
<mode>;</code>@ http://www.meami.org/ terminates the statement.
<mode>main</code>@ http://www.meami.org/ 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>@ http://www.meami.org/ function.
<mode>enum</code>@ http://www.meami.org/). 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>@ http://www.meami.org/), and untagged [[union
(computer science)|unions]] (
<mode>union</code>@ http://www.meami.org/).
<mode>struct</code>@ http://www.meami.org/ objects linked together
using pointers. Pointers to functions are useful for [[callback
(computer science)|callbacks]] from event handlers.
<mode>void *</code>@ http://www.meami.org/) 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>@ http://www.meami.org/ 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>@ http://www.meami.org/ can also be used when
<mode>x</code>@ http://www.meami.org/ is a pointer; the interpretation
(using pointer arithmetic) is to access the
<mode>(i+1)</code>@ http://www.meami.org/th of several adjacent data
objects pointed to by <
<mode>x</code>@ http://www.meami.org/, counting the object
<mode>x</code>@ http://www.meami.org/ points to (which is
<mode>x[0]</code>@ http://www.meami.org/) as the first element of the
array.
<mode>x[i]</code>@ http://www.meami.org/ is equivalent to
<mode>*(x + i)</code>@ http://www.meami.org/. Since the type of the
pointer involved is known to the compiler at compile time, the
address
<mode>x + i</code>@ http://www.meami.org/ points to is ''not'' the
address pointed to by
<mode>x</code>@ http://www.meami.org/ incremented by
<mode>i</code>@ http://www.meami.org/ bytes, but rather incremented
by
<mode>i</code>@ http://www.meami.org/ multiplied by the size of an
element
<mode>x</code>@ http://www.meami.org/ points to. The size of these
elements can be determined with the operator
<mode>[[sizeof]]</code>@ http://www.meami.org/ by applying it to any
dereferenced element of
<mode>x</code>@ http://www.meami.org/, as in
<mode>n = sizeof *x</code>@ http://www.meami.org/ or
<mode>n = sizeof x[0]</code>@ http://www.meami.org/.
<mode>sizeof </code>@ http://www.meami.org/''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>@ http://www.meami.org/ can be determined as
<mode>sizeof a / sizeof a[0]</code>@ http://www.meami.org/.
<mode>i[x] = 1;</code>@ http://www.meami.org/, which has the index
variable
<mode>i</code>@ http://www.meami.org/ apparently interchanged with the
array variable
<mode>x</code>@ http://www.meami.org/. This last line might be found
in [[International Obfuscated C Code Contest|obfuscated C]] code.
<mode><source lang="text"></code>@ http://www.meami.org/
<mode>/* x designates an array */</code>@ http://www.meami.org/
<mode>x[i] = 1;</code>@ http://www.meami.org/
<mode>x*(x + i) = 1;</code>@ http://www.meami.org/
<mode>*(i + x) = 1;</code>@ http://www.meami.org/
<mode>i[x] = 1; /* strange, but correct: i[x] is equivalent to *(i +
x) */</code>@ http://www.meami.org/
<mode></source></code>@ http://www.meami.org/
<mode>memcpy</code>@ http://www.meami.org/ function, for example.)
<mode>[[malloc]]</code>@ http://www.meami.org/ 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>@ http://www.meami.org/
<mode>[[malloc]]</code>@ http://www.meami.org/ for an example of
dynamically allocated arrays).
<mode>[[malloc|free()]]</code>@ http://www.meami.org/ 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>@ http://www.meami.org/, shorthand for "math
library").
(C) 2009. Mode/Code (TM) Language is a trademark of M. Michael Musatov
and MeAmI (http://www.meami.org) 'Search for the People!'(TM)
published10/31/2009
http://www.meami.org/ 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>@ http://www.meami.org/ function.
<mode>enum</code>@ http://www.meami.org/).

flowbase

unread,
Oct 31, 2009, 11:39:27 AM10/31/09
to
On Oct 31, 11:31 am, flowbase <marty.musa...@gmail.com> wrote:
> <mode>{mainspacehellospaceworld}</code>@http://www.meami.org/

> <mode>{main hello world}</code>@http://www.meami.org/
> <mode>                 {</code>@http://www.meami.org/
> <mode>2!!7!4</code>@http://www.meami.org/
> <mode>{(3*x^2)+(2*x)+1}'!4</code>@http://www.meami.org/
> <mode>x:25f:{(x^2)-1}</code>@http://www.meami.org/
> <mode>"Hello world!"</code>@http://www.meami.org/
> <mode>x@>#:'x</code>@http://www.meami.org/
> <mode>`show$"Hello world"</code>@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>@http://www.meami.org/rather than either of
> [[ALGOL 60]]'s
> <mode>begin ... end</code>@http://www.meami.org/or [[ALGOL 68]]'s

> <mode>( ... )</code>@http://www.meami.org/
> <mode>.EQ.</code>@http://www.meami.org/in [[Fortran]] or the equal-

> sign in [[BASIC]] and ALGOL)
> <mode>&amp;&amp;</code>@http://www.meami.org/and
> <mode>||</code>@http://www.meami.org/in place of ALGOL's "∧" (AND)

> and "∨" (OR) (these are semantically distinct from the [[bitwise
> operation|bit-wise]] operators
> <mode>&</code>@http://www.meami.org/and
> <mode>|</code>@http://www.meami.org/because they will never evaluate

> the right operand if the result can be determined from the left alone
> ([[short-circuit evaluation]])).
> <mode>+=</code>@http://www.meami.org/,
> <mode>++</code>@http://www.meami.org/, etc.  (Equivalent to [[ALGOL

> 68]]'s
> <mode>+:=</code>@http://www.meami.org/and
> <mode>+:=1</code>@http://www.meami.org/operators)
> <mode>struct</code>@http://www.meami.org/or
> <mode>union</code> type is supported)
> <mode>A..B</code>@http://www.meami.org/notation used in several
> languages
> <mode>_Bool</code>@http://www.meami.org/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>@http://www.meami.org/, but

> this does not provide all of the features of a separate Boolean
> datatype.</ref>
> <mode>[[errno]]</code>@http://www.meami.org/variable and/or special
> return values
> <mode>[[fflush]]()</code>@http://www.meami.org/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>@http://www.meami.org/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>@http://www.meami.org/data type

> <mode>unsigned int</code>@http://www.meami.org/data type
> <mode>=</code>'@http://www.meami.org/'op''(such as
> <mode>=-</code>@http://www.meami.org/) were changed to the form
> ''op''
> <mode>=</code>@http://www.meami.org/to remove the semantic ambiguity

> created by such constructs as
> <mode>i=-10</code>@http://www.meami.org/, which had been interpreted
> as
> <mode>i&nbsp;=-&nbsp;10</code>@http://www.meami.org/instead of the
> possibly intended
> <mode>i&nbsp;=&nbsp;-10</code>@http://www.meami.org/

> <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>@http://www.meami.org/declarations were be omitted

> in Mode/C.
> <mode>[[void type|void]]</code>@http://www.meami.org/functions
> <mode>[[Struct (C programming language)|struct]]</code>@http://www.meami.org/
> or
> <mode>[[union (computer science)|union]]</code>@http://www.meami.org/

> types (rather than pointers)
> <mode>struct</code>@http://www.meami.org/data types
> <mode>void</code>@http://www.meami.org/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>@http://www.meami.org/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>@http://www.meami.org/and a
> <mode>complex</code>@http://www.meami.org/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>@http://www.meami.org/, as in [[BCPL]] or C++. Many of

> these had already been implemented as extensions in several C
> compilers.
> <mode>int</code>@http://www.meami.org/implicitly assumed. A standard
> macro
> <mode>__STDC_VERSION__</code>@http://www.meami.org/is defined with
> value
> <mode>199901L</code>@http://www.meami.org/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>@http://www.meami.org/and
> <mode>*/</code>@http://www.meami.org/, or (in C99) following
> <mode>//</code>@http://www.meami.org/until the end of the line.

> <mode>struct</code>@http://www.meami.org/,
> <mode>union</code>@http://www.meami.org/, and
> <mode>enum</code>@http://www.meami.org/, 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>@http://www.meami.org/and
> <mode>int</code>@http://www.meami.org/specify built-in types.

> Sections of code are enclosed in braces (
> <mode>{</code>@http://www.meami.org/and
> <mode>}</code>@http://www.meami.org/, sometimes called "curly

> brackets") to limit the scope of declarations and to act as a single
> statement for control structures.
> <mode>if</code>@http://www.meami.org/(-
> <mode>else</code>@http://www.meami.org/) conditional execution and

> by
> <mode>do</code>@http://www.meami.org/-
> <mode>while</code>@http://www.meami.org/,
> <mode>while</code>@http://www.meami.org/, and
> <mode>for</code>@http://www.meami.org/iterative execution (looping).
> The
> <mode>for</code>@http://www.meami.org/statement has separate

> initialization, testing, and reinitialization expressions, any or all
> of which can be omitted.
> <mode>break</code>@http://www.meami.org/and
> <mode>continue</code>@http://www.meami.org/can be used to leave the

> innermost enclosing loop statement or skip to its reinitialization.
> There is also a non-structured
> <mode>[[goto]]</code>@http://www.meami.org/statement which branches

> directly to the designated [[label (programming language)|label]]
> within the function.
> <mode>switch</code>@http://www.meami.org/selects a
> <mode>case</code>@http://www.meami.org/to be executed based on the

> value of an integer expression.
> <mode>&&</code>@http://www.meami.org/,
> <mode>||</code>@http://www.meami.org/,
> <mode>[[?:]]</code>@http://www.meami.org/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>@http://www.meami.org/binding more tightly than

> <mode>&</code>@http://www.meami.org/and
> <mode>|</code>@http://www.meami.org/in expressions like

> <mode>x & 1 == 0</code>@http://www.meami.org/.
> <mode>=</code>@http://www.meami.org/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>@http://www.meami.org/and
> <mode>==</code>@http://www.meami.org/), 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>@http://www.meami.org/is only true if
> <mode>a</code>@http://www.meami.org/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>@http://www.meami.org/]], [[subtraction|
> <mode>-</code>@http://www.meami.org/]], [[multiplication|
> <mode>*</code>@http://www.meami.org/]], [[division (mathematics)|
> <mode>/</code>@http://www.meami.org/]], [[modulo operation|
> <mode>%</code>@http://www.meami.org/]])
> <mode>==</code>@http://www.meami.org/]], [[inequality (mathematics)|
> <mode>!=</code>@http://www.meami.org/]])
> <mode>&lt;</code>@http://www.meami.org/,

> <mode>&lt;=</code>@http://www.meami.org/,
> <mode>&gt;</code>@http://www.meami.org/,

> <mode>&gt;=</code>@http://www.meami.org/)
> <mode>!</code>@http://www.meami.org/,
> <mode>&&</code>@http://www.meami.org/,
> <mode>||</code>@http://www.meami.org/)
> <mode>~</code>@http://www.meami.org/,
> <mode>&</code>@http://www.meami.org/,
> <mode>|</code>@http://www.meami.org/,
> <mode>^</code>@http://www.meami.org/)
> <mode>&lt;&lt;</code>@http://www.meami.org/,

> <mode>&gt;&gt;</code>@http://www.meami.org/)
> <mode>=</code>@http://www.meami.org/,
> <mode>+=</code>@http://www.meami.org/,
> <mode>-=</code>@http://www.meami.org/,
> <mode>*=</code>@http://www.meami.org/,
> <mode>/=</code>@http://www.meami.org/,
> <mode>%=</code>@http://www.meami.org/,
> <mode>&=</code>@http://www.meami.org/,
> <mode>|=</code>@http://www.meami.org/,
> <mode>^=</code>@http://www.meami.org/,
> <mode>&lt;&lt;=</code>@http://www.meami.org/,

> <mode>&gt;&gt;=</code>@http://www.meami.org/)
> <mode>++</code>@http://www.meami.org/,
> <mode>--</code>@http://www.meami.org/)
> <mode>&</code>@http://www.meami.org/,
> <mode>*</code>@http://www.meami.org/,
> <mode>[ ]</code>@http://www.meami.org/)
> <mode>? :</code>@http://www.meami.org/]])
> <mode>.</code>@http://www.meami.org/,
> <mode>-></code>@http://www.meami.org/)

> <mode>( )</code>@http://www.meami.org/)
> <mode>[[sizeof]]</code>@http://www.meami.org/)

> <mode>( )</code>@http://www.meami.org/)
> <mode>,</code>@http://www.meami.org/]])
> <mode>( )</code>@http://www.meami.org/)

> <mode>main()
> <mode>{
> <mode>    printf("hello, world\n");
> <mode>}
> <mode></source></code>@http://www.meami.org/
> <mode><source lang="text"></code>@http://www.meami.org/
> <mode>#include <stdio.h></code>@http://www.meami.org/

> <mode>int main(void)</code>@http://www.meami.org/
> <mode>{</code>@http://www.meami.org/
> <mode>    printf("hello, world\n");</code>@http://www.meami.org/

> <mode>    return 0;</code>@http://www.meami.org/
> <mode>}</code>@http://www.meami.org/
> <mode></source></code>@http://www.meami.org/
> <mode>#include</code>@http://www.meami.org/.  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>@http://www.meami.org/standard header, which

> contains declarations for standard input and output functions such as
> <mode>printf</code>@http://www.meami.org/. The angle brackets

> surrounding
> <mode>stdio.h</code>@http://www.meami.org/indicate
> <mode>stdio.h</code>@http://www.meami.org/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>@http://www.meami.org/is being defined. The
> <mode>[[main function (programming)|main]]</code>@http://www.meami.org/

> function serves a special purpose in C programs:  The run-time
> environment calls the
> <mode>main</code>@http://www.meami.org/function to begin program
> execution. The type specifier
> <mode>int</code>@http://www.meami.org/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>@http://www.meami.org/function, is an integer. The
> keyword
> <mode>void</code>@http://www.meami.org/as a parameter list indicates
> the
> <mode>main</code>@http://www.meami.org/function takes no
> arguments.<ref>The
> <mode>main</code>@http://www.meami.org/function actually has two

> arguments,
> <mode>int argc</code>@http://www.meami.org/and
> <mode>char *argv[]</code>@http://www.meami.org/, respectively, which

> can be used to handle [[command line arguments]].  The C standard
> requires both forms of
> <mode>main</code>@http://www.meami.org/be supported, which is

> special treatment not afforded any other function.</ref>
> <mode>main</code>@http://www.meami.org/function.
> <mode>[[printf]]</code>@http://www.meami.org/, which was declared in
> <mode>stdio.h</code>@http://www.meami.org/and is supplied from a

> system [[library (computer science)|library]].  In this call, the
> <mode>printf</code@http://www.meami.org/> function is

> ''passed'' (provided with) a single argument, the address of the first
> character in the string literal
> <mode>"hello, world\n"</code>@http://www.meami.org/. The string

> literal is an unnamed [[Array data type|array]] with elements of type
> <mode>char</code>@http://www.meami.org/, set up automatically by the

> compiler with a final 0-valued character to mark the end of the array
> (
> <mode>printf</code>@http://www.meami.org/needs to know this). The
> <mode>\n</code>@http://www.meami.org/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>@http://www.meami.org/function is of type
> <mode>int</code>@http://www.meami.org/, 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>@http://www.meami.org/function succeeded.) The
> semicolon
> <mode>;</code>@http://www.meami.org/terminates the statement.
> <mode>main</code>@http://www.meami.org/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>@http://www.meami.org/function.
> <mode>enum</code>@http://www.meami.org/).  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>@http://www.meami.org/), and untagged [[union

> (computer science)|unions]] (
> <mode>union</code>@http://www.meami.org/).
> <mode>struct</code>@http://www.meami.org/objects linked together

> using pointers.  Pointers to functions are useful for [[callback
> (computer science)|callbacks]] from event handlers.
> <mode>void *</code>@http://www.meami.org/) 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>@http://www.meami.org/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>@http://www.meami.org/can also be used when
> <mode>x</code>@http://www.meami.org/is a pointer; the interpretation

> (using pointer arithmetic) is to access the
> <mode>(i+1)</code>@http://www.meami.org/thof several adjacent data
> objects pointed to by <
> <mode>x</code>@http://www.meami.org/, counting the object
> <mode>x</code>@http://www.meami.org/points to (which is
> <mode>x[0]</code>@http://www.meami.org/) as the first element of the
> array.
> <mode>x[i]</code>@http://www.meami.org/is equivalent to
> <mode>*(x + i)</code>@http://www.meami.org/. Since the type of the

> pointer involved is known to the compiler at compile time, the
> address
> <mode>x + i</code>@http://www.meami.org/points to is ''not'' the

> address pointed to by
> <mode>x</code>@http://www.meami.org/incremented by
> <mode>i</code>@http://www.meami.org/bytes, but rather incremented
> by
> <mode>i</code>@http://www.meami.org/multiplied by the size of an
> element
> <mode>x</code>@http://www.meami.org/points to. The size of these

> elements can be determined with the operator
> <mode>[[sizeof]]</code>@http://www.meami.org/by applying it to any
> dereferenced element of
> <mode>x</code>@http://www.meami.org/, as in
> <mode>n = sizeof *x</code>@http://www.meami.org/ or

> <mode>n = sizeof x[0]</code>@http://www.meami.org/.
> <mode>sizeof </code>@http://www.meami.org/''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>@http://www.meami.org/ can be determined as
> <mode>sizeof a / sizeof a[0]</code>@http://www.meami.org/.
> <mode>i[x] = 1;</code>@http://www.meami.org/, which has the index
> variable
> <mode>i</code>@http://www.meami.org/apparently interchanged with the
> array variable
> <mode>x</code>@http://www.meami.org/. This last line might be found

> in [[International Obfuscated C Code Contest|obfuscated C]] code.
> <mode><source lang="text"></code>@http://www.meami.org/
> <mode>/* x designates an array */</code>@http://www.meami.org/
> <mode>x[i] = 1;</code>@http://www.meami.org/
> <mode>x*(x + i) = 1;</code>@http://www.meami.org/
> <mode>*(i + x) = 1;</code>@http://www.meami.org/

> <mode>i[x] = 1; /* strange, but correct: i[x] is equivalent to *(i +
> x) */</code>@http://www.meami.org/
> <mode></source></code>@http://www.meami.org/
> <mode>memcpy</code>@http://www.meami.org/function, for example.)
> <mode>[[malloc]]</code>@http://www.meami.org/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>@http://www.meami.org/
> <mode>[[malloc]]</code>@http://www.meami.org/for an example of
> dynamically allocated arrays).
> <mode>[[malloc|free()]]</code>@http://www.meami.org/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>@http://www.meami.org/, shorthand for "math

> library").
> (C) 2009. Mode/Code (TM) Language is a trademark of M. Michael Musatov
> and MeAmI (http://www.meami.org) 'Search for the People!'(TM)
> published10/31/2009http://www.meami.org/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>@http://www.meami.org/function.
> <mode>enum</code>@http://www.meami.org/).
<mode>-lm</code>@spacehttp://
www.meami.org/,spaceshorthandspaceforspace"mathspacelibrary").space
(C)space2009.spaceMode/Codespace(TM)
spaceLanguagespaceisspaceaspacetrademarkspaceofspaceM.spaceMichaelspaceMusatovspaceandspaceMeAmIspace
(http://www.meami.org)space'SearchspaceforspacethespacePeople!'(TM)
spacepublished10/31/2009
ECHOspaceEnvironment'(TM)space[orspaceMEAMI[DOT]ORG]
spaceMeAmI.org,spaceMeAmI128,spaceM.spaceMichaelspaceMusatov.spacehalted.spaceM.MichaelspaceMusatov.spaceECHOspace@spacehttp://
www.meami.org.spaceECHOspace92space0spaceobj.spaceECHOspace543spacehalted.spaceECHOspaceSMUB:spaceBinaryspaceSearchspaceforspacecurrentspacesourcespacevaluespaceonspaceB/EspacesuchspacethatspaceC/EspacecurrentspacehaltedspaceDefinespaceeachspacestepspaceinspacethespacetestspaceasspaceaspacefunction.spaceThisspaceaidsspaceinspacecodespacereuse,spacehalted
P=NP!@http://www.meami.org/?
0 new messages