Chapter 6. Extensions to the C Language Family
6.17. String Literals with Embedded Newlines
As an extension, GNU CPP permits string literals to cross multiple lines without escaping the embed-
ded newlines. Each embedded newline is replaced with a single
literal, regardless of what form the newline took originally.
CPP currently allows such strings in directives as well (other than the
deprecated and will eventually be removed.
6.18. Non-Lvalue Arrays May Have Subscripts
In ISO C99, arrays that are not lvalues still decay to pointers, and may be subscripted, although they
may not be modified or used after the next sequence point and the unary
to them. As an extension, GCC allows such arrays to be subscripted in C89 mode, though otherwise
they do not decay to pointers outside C99 mode. For example, this is valid in GNU C though not valid
in C89:
struct foo {int a[4];};
struct foo f();
bar (int index)
{
return f().a[index];
}
6.19. Arithmetic on
In GNU C, addition and subtraction operations are supported on pointers to
functions. This is done by treating the size of a
A consequence of this is that
The option
-Wpointer-arith
6.20. Non-Constant Initializers
As in standard C++ and ISO C99, the elements of an aggregate initializer for an automatic variable are
not required to be constant expressions in GNU C. Here is an example of an initializer with run-time
varying elements:
foo (float f, float g)
{
float beat_freqs[2] = { f-g, f+g };
/* ... */
}
6.21. Compound Literals
ISO C99 supports compound literals. A compound literal looks like a cast containing an initializer. Its
value is an object of the type specified in the cast, containing the elements specified in the initializer;
it is an lvalue. As an extension, GCC supports compound literals in C89 mode and in C++.
Usually, the specified type is a structure. Assume that
shown:
- and Function-Pointers
void
void
is also allowed on
sizeof
requests a warning if these extensions are used.
character in the resulting string
\n
#include
operator may not be applied
&
or of a function as 1.
and on function types, and returns 1.
void
and
struct foo
structure
133
family). This is
and on pointers to
void
are declared as
Need help?
Do you have a question about the ENTERPRISE LINUX 3 - USING GCC and is the answer not in the manual?
Questions and answers