]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/doc/gcc/extensions-to-the-c-language-family/mixed-declarations-labels-and-code.rst
sphinx: add missing trailing newline
[thirdparty/gcc.git] / gcc / doc / gcc / extensions-to-the-c-language-family / mixed-declarations-labels-and-code.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:: mixed declarations and code, declarations, mixed with code, code, mixed with declarations
7
8 .. _mixed-labels-and-declarations:
9
10 Mixed Declarations, Labels and Code
11 ***********************************
12
13 ISO C99 and ISO C++ allow declarations and code to be freely mixed
14 within compound statements. ISO C2X allows labels to be
15 placed before declarations and at the end of a compound statement.
16 As an extension, GNU C also allows all this in C90 mode. For example,
17 you could do:
18
19 .. code-block:: c++
20
21 int i;
22 /* ... */
23 i++;
24 int j = i + 2;
25
26 Each identifier is visible from where it is declared until the end of
27 the enclosing block.