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 revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
acc [2017/07/09 14:11] korshunacc [2017/07/11 00:28] 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 =====
Line 28: 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 41: Line 44:
 } }
 </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:
 +  * Replacing ''int'' with ''void''
 +  * Adding more code 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 ==== ==== No "fixed" type ====
acc.txt · Last modified: 2017/07/14 22:23 by korshun