]> git.xonotic.org Git - xonotic/xonotic.wiki.git/blob - NewQC.textile
(Commit created by redmine exporter script from page "NewQC" version 3)
[xonotic/xonotic.wiki.git] / NewQC.textile
1 h1. New QC Syntax
2
3 It is possible that at some point we decide to switch QC-compiler which requires some changes to the code.
4
5 h2. Clean syntax:
6
7 In fteqcc there are some ambiguities regarding fieldpointers, function pointers, and field-return-types etc.
8 A clean syntax is needed, *SUGGESTIONS ARE WELCOME*, my(blub's) current suggestion is (currently not complete):
9
10 |_.definition|_.meaning|
11 |<code>float foo(void)</code>|     function|
12 |<code>float foo*(void)</code>|    function pointer|
13 |<code>.float foo(void)</code>|    member: method/function pointer|
14 |<code>..float foo(void)</code>|/2. member: method/function pointer returning .float|
15 |<code>..*float foo(void)</code>|
16 |<code>.*float foo*(void)</code>|  function pointer returning .float|
17 |<code>.*float</code>|             fieldpointer|
18 |<code>.*float foo(void)</code>|   fieldpointer: method/function pointer|
19 |<code>.*.float foo(void)</code>|  fieldpointer: method/function pointer returning .float|
20
21 Additionally, at places where the definition of members or global functions is not allowed, they will be treated like fieldpointers.
22 So inside parameterlists or a functionbody the list is as follows:
23
24 |_.definition|_.meaning|
25 |<code>float foo(void)</code>|     function|
26 |<code>float foo*(void)</code>|    function pointer|
27 |<code>.float foo(void)</code>|    *fieldpointer: method/function pointer*|
28 |<code>..float foo(void)</code>|/2. *fieldpointer: method/function pointer returning .float*|
29 |<code>..*float foo(void)</code>|
30 |<code>.*float foo*(void)</code>|  function pointer returning .float|
31 |<code>.*float</code>|             fieldpointer|
32 |<code>.*float foo(void)</code>|   fieldpointer: method/function pointer|
33 |<code>.*.float foo(void)</code>|  fieldpointer: method/function pointer returning .float|
34
35 h2. Function definitions:
36
37 The old-style QC way of defining functions will not be supported, so
38 <pre>void(float x) something = { ... }</pre>
39 becomes
40 <pre>void something(float x) { ... }</pre>
41 which is the most common way to define functions in the xonotic code already anyway.
42
43 h2. Constants:
44
45 From now on, the code
46 <pre>float x = 3</pre>
47 does what the first instinct tells you: it creates a global with the initial value 3. Contrary to old QC, where it created a constant.
48 To create a constant use:
49 <pre>const float x = 3</pre>