ACSUtils Wiki

An ACS library for ZDoom-based ports

User Tools

Site Tools


acc

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
acc [2017/07/09 14:02]
korshun
acc [2017/07/14 22:23] (current)
korshun
Line 1: Line 1:
 +{{tag>acs_compilers}}
 ====== ACC ====== ====== ACC ======
 ACC is the official ACS compiler. ACC is the official ACS compiler.
  
 Alternative ACS compilers: [[BCC]], [[GDCC]]. Alternative ACS compilers: [[BCC]], [[GDCC]].
 +
 +  * **GitHub**: https://github.com/rheit/acc/
  
 ===== Known bugs ===== ===== Known bugs =====
 +
 +==== 256 function limit ====
 +
 +ACSUtils has a lot more than 256 functions, but official releases of ACC can't compile programs with more than 256 functions.
 +
 +To fix this, download the April 26, 2017 development version of ACC (unofficial build for Windows): http://acsutils.strangled.net/lib/exe/fetch.php?media=acc-1.56-beta-g3256a3e.zip
  
 ==== Mixing strings and numbers in an array corrupts the numbers ==== ==== Mixing strings and numbers in an array corrupts the numbers ====
Line 22: Line 31:
 This bug only affects non-local arrays and happens randomly, usually only with large arrays. This bug only affects non-local arrays and happens randomly, usually only with large arrays.
  
-To avoid this bug, **do not use static initialization with non-local arrays**, instead, declare an empty array and initialize it in a function:+To avoid this bug, **do not use static initialization with non-local arrays, this includes multidimensional arrays**, instead, declare an empty array and initialize it in a function:
  
 <code> <code>
Line 29: Line 38:
 function void InitArrays() function void InitArrays()
 { {
-    SomeArray[0] = 1; +    int i = 0; 
-    SomeArray[1] = 3.14159; +    SomeArray[i++] = 1; 
-    SomeArray[2] = "string";+    SomeArray[i++] = 3.14159; 
 +    SomeArray[i++] = "string";
 } }
 </code> </code>
 +
 +Or, in a more beautiful way:
 +
 +<code>
 +int SomeArray[3];
 +int SomeArrayCount = 0;
 +
 +function void AddEntry(int x)
 +{
 +    SomeArray[SomeArrayCount++] = x;
 +}
 +
 +function void InitArray(void)
 +{
 +    AddEntry(1);
 +    AddEntry(3.14159);
 +    AddEntry("string");
 +}
 +</code>
 +
 +==== Strange compiler crash (ACC 1.56 beta Windows build only) ====
 +
 +<code>
 +#include "zcommon.acs"
 +
 +function int f(void)
 +{
 +    while (0)
 +        continue;
 +    return 0;
 +}
 +
 +function int g(void)
 +{
 +    while (0)
 +        continue;
 +    return 0;
 +}
 +</code>
 +
 +This code causes the compiler to enter an infinite loop. Any of the following fixes the issue:
 +
 +  * Removing one of the functions
 +  * Removing ''return 0;'' in one of the functions (causes compiler error, as expected)
 +  * Replacing ''continue;'' with ''break;'' in one of the functions
 +
 +But the following does not:
 +  * Changing the loop condition
 +  * Replacing ''int'' with ''void''
 +  * Adding more code before and after continue, both inside and outside the loop
 +  * Adding more functions anywhere else
 +  * Replacing "while" loop with "for"
 +
 +==== Local variable names can conflict with global names ====
 +
 +<code>
 +#define SOMENAME1 1
 +int somename2 = 2;
 +function void somename3(void) {}
 +
 +function f(int somename1) // ERROR
 +{
 +    int somename2; // ERROR
 +    int somename3; // ERROR
 +}
 +</code>
 +
 +Local variables can't have the same names as any global names (function, constant, variable names). Unlike other compilers, local variable names don't shadow the global names, but trigger a compiler error.
 +
 +==== No "fixed" type ====
 +
 +There is no type called ''fixed'' in ACC. Only ''int'', ''bool'' and ''str''.
  
acc.1499598142.txt.gz · Last modified: 2017/07/09 14:02 by korshun