EasyManua.ls Logo

Intel i960 - Non-Lvalue Arrays Can Have Subscripts

Intel i960
347 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Language Implementation
7-45
7
In standard C, you would have to give contents a length of 1, which
means either you waste space or complicate the argument to
malloc.
Non-lvalue Arrays Can Have Subscripts
Subscripting is allowed on arrays that are not lvalues, even though the
unary
& operator is not. For example, this is valid though not valid in
some other C dialects:
struct foo {int a[4];};
struct foo f();
bar (int index)
{
return f().a[index];
}
Arithmetic on Pointers to void and Pointers to
Functions
Addition and subtraction operations are supported on pointers to void and
on pointers to functions. This is done by treating the size of a
void or of a
function as 1.
A consequence of this is that
sizeof is also allowed on void and on
function types, and returns 1.
The
Wpointer-arith option requests a warning if these extensions are
used.

Table of Contents

Related product manuals