]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/doc/gcc/extensions-to-the-c-language-family/non-constant-initializers.rst
sphinx: copy files from texi2rst-generated repository
[thirdparty/gcc.git] / gcc / doc / gcc / extensions-to-the-c-language-family / non-constant-initializers.rst
1 ..
2 Copyright 1988-2022 Free Software Foundation, Inc.
3 This is part of the GCC manual.
4 For copying conditions, see the copyright.rst file.
5
6 .. index:: initializers, non-constant, non-constant initializers
7
8 .. _initializers:
9
10 Non-Constant Initializers
11 *************************
12
13 As in standard C++ and ISO C99, the elements of an aggregate initializer for an
14 automatic variable are not required to be constant expressions in GNU C.
15 Here is an example of an initializer with run-time varying elements:
16
17 .. code-block:: c++
18
19 foo (float f, float g)
20 {
21 float beat_freqs[2] = { f-g, f+g };
22 /* ... */
23 }