ACC Incompatibility

From GDCC Wiki
Revision as of 01:25, 7 October 2016 by TheZombieKiller (talk | contribs) (Created page with "While gdcc-acc is for the most part backwards-compatible with acc, there are a number of incompatibilities that will prevent ''some'' acc-centric code from compiling. == Inco...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

While gdcc-acc is for the most part backwards-compatible with acc, there are a number of incompatibilities that will prevent some acc-centric code from compiling.

Incorrectly typed arrays

In gdcc-acc, incorrectly typed arrays (for example, an array of strings using the type 'int') are not allowed.

int my_array[2] = { "Hello", "World" };

The fix for this is to use the correct type, str.

Function prototypes

Unlike acc, functions in gdcc-acc cannot be used before being declared or defined.

script "hello_world" (void)
{
    sample_function();
}

function void sample_function(void)
{
    Log(s:"Hello world");
}

The solution to this is to either move the function above its first usage in the code, or add a function prototype before it is used, such as the following:

function void sample_function(void);