]>
Commit | Line | Data |
---|---|---|
c63539ff ML |
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:: void pointers, arithmetic, void, size of pointer to, function pointers, arithmetic, function, size of pointer to | |
7 | ||
8 | .. _pointer-arith: | |
9 | ||
10 | Arithmetic on void- and Function-Pointers | |
11 | ***************************************** | |
12 | ||
13 | In GNU C, addition and subtraction operations are supported on pointers to | |
14 | ``void`` and on pointers to functions. This is done by treating the | |
15 | size of a ``void`` or of a function as 1. | |
16 | ||
17 | A consequence of this is that ``sizeof`` is also allowed on ``void`` | |
18 | and on function types, and returns 1. | |
19 | ||
20 | .. index:: Wpointer-arith | |
21 | ||
22 | The option :option:`-Wpointer-arith` requests a warning if these extensions | |
3ed1b4ce | 23 | are used. |