Skip to content

Refactor [book chapter Example: Building a hello world program ] #865

Open
@abroooo

Description

@abroooo

Is your refactor request related to a problem? Please describe.
Not a code refactor but documentation. I recently stumbled across the naming of the entrypoint function. It needs to be called main (unless explicitly set to sth else) and it needs to be a FUNCTION to be a stand-alone application. Using a PROGRAM might seemingly work but will end in weird segfaults.

Describe the solution you'd like
Maybe just mention why it needs to be called main and that the type needs to be FUNCTION.

Additional context

We want to print something to the terminal, so we're going to declare external functions for that.
This example is available under `examples/hello_world.st` in the main RuSTy repository.
- `main` is our entry point to the program.
- To link the program, we are going to use the system's linker using the `--linker=cc` argument.
- On windows, replace this with --linker=clang as cc is usually not available.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationrefactorinternal change, cleanup, code-style-improvement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions