Re:Sj.h: A tiny little JSON parsing library in ~150 lines of...
by jeroenhd on Sunday September 21, 2025 @03:56PM
(#45326091)
Very few programming languages default to checked increments. Most Rust or Java programmers would make the same mistake.
Writing a function to do a checked addition like in other languages isn't exactly difficult, either.
Re:Sj.h: A tiny little JSON parsing library in ~150 lines of...
by paulddraper on Sunday September 21, 2025 @04:37PM
(#45326402)
Yes but those languages have defined overflow.
Re:Sj.h: A tiny little JSON parsing library in ~150 lines of...
by cozzyd on Sunday September 21, 2025 @05:28PM
(#45326829)
-fwrapv
Re:Sj.h: A tiny little JSON parsing library in ~150 lines of...
by koito17 on Sunday September 21, 2025 @06:20PM
(#45327197)
> Most Rust or Java programmers would make the same mistake.
Detecting these mistakes in Rust is not too difficult. In debug builds, integer overflow triggers a panic[1]. Additionally, clippy (the official linter of Rust), has a rule[2] to detect this mistake.
[1] https://doc.rust-lang.org/book/ch03-02-data-types.html#integ...
[2] https://rust-lang.github.io/rust-clippy/master/index.html#ar...
Re:Sj.h: A tiny little JSON parsing library in ~150 lines of...
by account42 on Tuesday September 23, 2025 @10:17AM
(#45347368)
You can also just use ubsan if you want the runtime checks for overflows in C/C++, no need to switch languages for this.
Re:Sj.h: A tiny little JSON parsing library in ~150 lines of...
by zelphirkalt on Monday September 22, 2025 @05:43AM
(#45331078)
Many other languages automatically switch to a big integer number type, or have arbitrary size integers anyway.
(TIP: choose the latter)