Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • sac2c sac2c
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 397
    • Issues 397
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 12
    • Merge requests 12
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • sac-group
  • sac2csac2c
  • Wiki
  • Concepts
  • Globals

Globals · Changes

Page history
Add Globals.md authored Mar 06, 2025 by Quinten Cabo's avatar Quinten Cabo
Hide whitespace changes
Inline Side-by-side
concepts/Globals.md 0 → 100644
View page @ 4e05af54
In sac2c there are a lot of global variables that are used to store context information.
For instance compiler flags passed to the compiler.
However, the usage of global variables should be as limited as possible since a functional programming style is preferred in the SAC project.
These globals are stored in the global variable `global` of type `global_t`.
These are defined in `src/libsac2c/global/globals.c`, `src/libsac2c/global/globals.h` and `src/libsac2c/global/globals.mac`.
The `global_t` type is defined in `types.h` and generated from these 3 files.
A global is defined like this insdie `globals.mac` using the `GLOBAL()` macro from `types.h`:
```c
GLOBAL (bool, loadprelude, TRUE, xfree_dummy, )
```
The value type, the name, the default value, the free function are passed to the macro in this order.
\ No newline at end of file
Clone repository
  • concepts
    • Deprecated Modules
    • Globals
    • Intermediate Code Macros
    • Named Tuples
    • Overloading
    • Preprocessor
    • Primitive functions
    • Runetime Representations
    • input stdin
    • phm xt
    • ref counting methods
    • type famlies
    • type patterns
  • error messages
    • Anthropomorphic error essages
    • Colored error messages
View All Pages