|
1 | 1 | /***************************************************************************//**
|
2 | 2 | * @file documentation.h
|
3 | 3 | * @brief This file contains useful documentation about the project.
|
4 |
| - * @version 3.0 |
| 4 | + * @version 3.1 |
5 | 5 | * @author Brecht Van Eeckhoudt
|
6 | 6 | *
|
7 | 7 | * ******************************************************************************
|
|
271 | 271 | *
|
272 | 272 | * The `volatile` type indicates to the compiler that the data is not normal memory,
|
273 | 273 | * and could change at unexpected times. Hardware registers are often volatile,
|
274 |
| - * and so are variables which get changed in interrupts. |
| 274 | + * and so are variables which get changed in interrupts.@n |
| 275 | + * Volatile variables are stored in *RAM*. |
275 | 276 | *
|
276 |
| - * @subsection Extern |
| 277 | + * @subsection Static |
277 | 278 | *
|
278 |
| - * Declare the global variables in headers (and use the `extern` keyword there) |
279 |
| - * and actually define them in the appropriate source file. |
| 279 | + * @subsubsection VARIABLE Static variable |
280 | 280 | *
|
281 |
| - * @subsection Static |
| 281 | + * During compile time (this is why we can't use variable length array's) memory |
| 282 | + * gets reserved for this variable. The data itself gets put in the *data* segment |
| 283 | + * of the memory (regular variables are put in the *stack* segment).@n |
| 284 | + * It's best to keep the use of `static` variables to a minimum. One should ask |
| 285 | + * himself the question if it's necessary to keep the variable constantly in the |
| 286 | + * memory. If the answer is yes, a `static` variable is acceptable.@n |
| 287 | + * A **static variable inside a function** keeps its value between invocations. |
| 288 | + * |
| 289 | + * @subsubsection FUNCTION Static global function |
282 | 290 | *
|
283 |
| - * - **Static variable inside a function:** The variable keeps its value between invocations. |
284 |
| - * - **Static global variable or function:** The variable or function is only "seen" in the file it's declared in. |
| 291 | + * The function is only "seen" in the file it's declared in. This means `static` |
| 292 | + * can be used for methods the same way `private` is used for certain methods in C++. |
285 | 293 | *
|
286 | 294 | * ******************************************************************************
|
287 | 295 | *
|
|
0 commit comments