3 ms·
Can you give examples of the peculiarities? I write cpp all day and zig is a nice change for me because of how simple it is to me
by rhodysurf 7y ago
Can you give examples of the peculiarities? I write cpp all day and zig is a nice change for me because of how simple it is to me
- richardwhiuk 7y ago> Zig both signed and unsigned integers have undefined behavior on overflow, contrasted to only signed integers in C make a feature unwanted in C, worse. nice.
- AnIdiotOnTheNet 7y agodebug and safe modes in zig disallow overflows entirely unless you specifically use the wrapping operator to clearly specify your intent. These checks are removed in speed-optimized builds. In other words, the compiler will enforce that `a + b` does not overflow through all your testing and wherever you explicitly say such checks are required, but turns them into nops for you when you desire speed. You can let the compiler know that you explicitly want wrapping overflow (and not some undefined kind) using the wrapping operator `a +% b`.
- stateoff 7y agoPlease check your facts: https://ziglang.org/documentation/master/#Integer-Overflow https://ziglang.org/documentation/master/#Integer-Overflow