>Why string literals and numbers are considered "global" in QuakeC
>In QuakeC, string literals and numbers are often conceptually global because of how the Quake engine handles data storage and access:
>1. String literals
>
> String literals (e.g., "Hello world") are stored in a read-only section of the data segment within the Quake engine, according to Substack. This means they are immutable and exist for the entire duration of the game, rather than being created and destroyed on the stack for each function call.
> When a string literal is used multiple times, the compiler or engine often stores only one copy in memory and directs all references to that single location. This makes them globally accessible in a practical sense, as any part of the code can reference the same literal without creating new instances.
> QuakeC also features built-in functions like ftos (float to string) and vtos (vector to string) that generate temporary strings. These strings are stored in a dedicated buffer and only last for the duration of the function call within the Quake engine.
>
>2. Numbers (floats)
>
> The primary numeric type in QuakeC is float. These are 32-bit floating-point numbers.
> Similar to string literals, when a literal number (like 128) is used in QuakeC code, the Quake engine's data handling often treats these as globally accessible constants. They exist as part of the overall game state accessible to the QuakeC code.
> The progs.dat file, containing the compiled QuakeC code, includes a "Definitions data" section storing floating-point values, integers, and vectors. These are generally available throughout the QuakeC environment.
>
>In summary, the "global" nature of string literals and numbers in QuakeC stems from their storage in dedicated memory areas and their accessibility throughout the game engine's execution, rather than being confined to specific function scopes or requiring explicit dynamic allocation and deallocation.