mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-01 15:03:39 +02:00
docs: General cleanups and rewording in the GObject concepts docs
• Remove copies of function declarations from the explanation — if people want those, they can follow links to the reference manual. • Add markup to make C code more defined. • Remove use of first person and irrelevant name dropping. https://bugzilla.gnome.org/show_bug.cgi?id=744060
This commit is contained in:
@@ -34,7 +34,7 @@
|
||||
<title>Data types and programming</title>
|
||||
|
||||
<para>
|
||||
One could say (I have seen such definitions used in some textbooks on programming language theory)
|
||||
One could say
|
||||
that a programming language is merely a way to create data types and manipulate them. Most languages
|
||||
provide a number of language-native types and a few primitives to create more complex types based
|
||||
on these primitive types.
|
||||
@@ -44,7 +44,7 @@
|
||||
In C, the language provides types such as <emphasis>char</emphasis>, <emphasis>long</emphasis>,
|
||||
<emphasis>pointer</emphasis>. During compilation of C code, the compiler maps these
|
||||
language types to the compiler's target architecture machine types. If you are using a C interpreter
|
||||
(I have never seen one myself but it is possible :), the interpreter (the program which interprets
|
||||
(assuming one exists), the interpreter (the program which interprets
|
||||
the source code and executes it) maps the language types to the machine types of the target machine at
|
||||
runtime, during the program execution (or just before execution if it uses a Just In Time compiler engine).
|
||||
</para>
|
||||
@@ -87,17 +87,20 @@ print "this is an integer converted to a string:" . $tmp . "\n";
|
||||
|
||||
<para>
|
||||
For the sake of discussion, here is a sample C function and the associated 32 bit x86
|
||||
assembly code generated by GCC on my Linux box:
|
||||
assembly code generated by GCC on a Linux computer:
|
||||
<informalexample><programlisting>
|
||||
static void function_foo (int foo)
|
||||
{}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
static void
|
||||
function_foo (int foo)
|
||||
{
|
||||
}
|
||||
|
||||
function_foo (10);
|
||||
int
|
||||
main (int argc,
|
||||
char *argv[])
|
||||
{
|
||||
function_foo (10);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
push $0xa
|
||||
@@ -106,7 +109,7 @@ call 0x80482f4 <function_foo>
|
||||
The assembly code shown above is pretty straightforward: the first instruction pushes
|
||||
the hexadecimal value 0xa (decimal value 10) as a 32-bit integer on the stack and calls
|
||||
<function>function_foo</function>. As you can see, C function calls are implemented by
|
||||
gcc by native function calls (this is probably the fastest implementation possible).
|
||||
GCC as native function calls (this is probably the fastest implementation possible).
|
||||
</para>
|
||||
|
||||
<para>
|
||||
|
Reference in New Issue
Block a user