<< Go back to the StrictAL page
StrictAL's documentation.

Table of contents.

Characters and Strings.

Single characters and string literals in StrictAL almost the same as in ANSI C with few minor differences. They can be defined only as char type. There is no wchar_t data type and no need to specify L prefix before quotes. The compiler makes a choice between single-byte characters and wide characters depending on compilation flags.

Characters are enclosed in single quotes.

Strings are enclosed in double quotes and follows the rules:

// Both variants are valid:

char *text = "Even the smallest person can "
    "change the course of the future.";

char *text = "May it be a light to you in dark
    places, when all other lights go out.";

SALCONV wraps all constant strings with _T() macro:

char someText[] = "Hello, World!";

// After conversion:

char someText[] = _T("Hello, World!");

Comments.

StrictAL supports the same types of comments as C99 (single-line and multi-line). Single-line comment starts with two forward slashes (//) and ends in the end of the line. Multi-line comment is contained in block opened by forward slash with asterisk (/*) and closed by asterisk with forward slash (*/). Multi-line comments cannot be nested.

// Hello, I'am a single line comment.

/* And I'am a multi-line comment
   with a lot of useful information. */

SALCONV changes all single-line comments to multi-line type:

// Some ordinary comment.

After conversion:

/* Some ordinary comment. */

Escaped characters.

To escape a character backslash (\) is used. Escaped characters are allowed only in single-quoted and double-quoted strings with some restrictions, usage of backslashes outside of comments and strings will rise a compilation error. Escaping of line ending is prohibited in any cases.

// Valid code:

char *text = "It's called \"An Unexpected Party\".";

// Invalid code:

char *text = "First part of the text \
    Second part of the text";

Source files.

Files with source code have ".sals" file extension and must contain only spaces, horizontal tabulations, newlines and visible printable ASCII characters.

Functions.

const char * getenv (char *varname)
varname - Environment variable name
Gets a value from an environment variable. Returns a pointer to the environment table entry containing varname. It is not allowable to modify the value of the environment variable using the returned pointer. Use the putenv function to modify the value of an environment variable. The return value is NULL if varname isn't found in the environment table.