GNU COMPATIBILITY
Some compatibility with the enhanced language features of GNU C is available
within VectorC. To enable these options, you need to use the /gnu or /vec:gnu
command-line option.
$ allowed in identifiers
Macros with variable number of parameters
If the last macro parameter is specified with a "..." after it, then
that parameter represents a list of any number of arguments supplied to the macro.
e.g.
#define TEST(a,b...) printf (a, 5, b)
TEST ("5=%d, 6=%d, 7=%d\n", 6, 7);
Compound expressions
You can write a compound statement within an expression. The value of the last
statement is the value of the expression.
e.g.
int a = ({printf ("assigning a\n"); 5;});
Finding the address of a local label
The && unary operator can be used to give the address of a local label.
e.g.
{
void *addr;
label:
addr = &&label;
}
Constant structure constructors in expressions
You can specify a structured constant within an expression by placing the structured
constant after a structure cast.
e.g.
struct TEST a;
a = (struct TEST) {3, 4, 5};
Missing the middle argument of a conditional expression
If the middle argument of a conditional expression is missing, it is assumed
to be the value of the condition.
e.g.
a = b ?: c;
If b is non-zero, the value of the expression is b, otherwise the value is
c.
Conditional expressions can be LValues
The result of a conditional expression can be used on the left hand side of
an assignment.
Ranges in case statements
Cases in switch statements can use "..." to specify a range of values.
Goto expression
Gotos can take a variable value if a "*" is put before the expression.
Non-constant initializers
Elements of structured intializers can be non-constant expressions, if the
variable being assigned is local and not static.
Array of length 0
Arrays can have a length of 0.
Typedef from an expression
The type in a typedef declaration can be taken as the type of an expression
e.g.
int a;
typedef TYPE = a;
Forward declaration of a label
Labels can be declared before use with the __label__ keyword.
__typeof__
Anywhere where a type is required - e.g. a declaration or cast - the
__typeof__ keyword can be used to return the type of an expression.
e.g.
a = (__typeof__ (a)) 4;
__attribute__
Special attributes of identifiers can be set with the __attribute__ keyword.
This is similar to the __declspec keyword.
__attribute__ ((__stdcall)) or __attribute__
((stdcall)) or __attribute ((__stdcall__))
__attribute__ ((__pascal))
__attribute__ ((__fastcall))
__attribute__ ((__syscall))
__attribute__ ((dllexport))
__attribute__ ((dllimport))
__attribute__ ((wcall))
__attribute__ ((naked))
__attribute__ ((thread)) or __attribute__
((__thread__))
__attribute__ ((alignedvalue (n))) or __attribute__
((__alignedvalue__ (n)))
__attribute__ ((aligned (n))) or __attribute__
((__aligned__ (n)))
__attribute__ ((packed)) or __attribute__
((__packed__))
__attribute__ ((noreturn)) or __attribute__
((__noreturn__))
__attribute__ ((const)) or __attribute__ ((__const__))
|