Q regarding design of Zig: What is the advantage of @import (Zig) in comparison with #include (C)?

Hi,

What is/are the advantage/s of @import (Zig) in comparison with #include (C) ?

Cheers!
Tuxic

  • C’s include is only text replacement, the body of a header will be inserted into where it’s included.
  • Zig’s import is used as namespace, which is not available in C.

https://mattnite.github.io/posts/import-and-packages/

3 Likes

Thank you for the information and the link! :slight_smile: