Beginner's Guide to Zig Part 13 - Compiling C code and converting C to Zig

Поділитися
Вставка
  • Опубліковано 21 лис 2024

КОМЕНТАРІ • 1

  • @cfansword
    @cfansword 3 місяці тому

    zig translate-c inserts a discarded reference after every variable declaration because the rules of the zig compiler don't allow you to have unused variables. However the rules of C do and thus zig can't guarantee that they will be used. That way the translated program is still acting as close as possible to the C one (allocating space for a c_int) while still being able to be compiled under the rules of zig 👍