Better HN
topnewbestaskshowjobs
Log inSign up

wCxV8HzziQBb

2 karma · joined Aug 11, 2023 (3y ago) · 4 submissions

Submissions

comment 6mo ago · link · parent

The bound on ures <= 0x80[...] should be either ures < 0x80[...] or ures <= 0x7F[...]. Otherwise, parsing negative `0x8000000000000000` will run code to negate the signed integer INT64_MIN (-0x80[...]) to 0x80[...], which doesn't fit in an integer (INT*_MAX is 0x80[...]).

    $ clang parseint.c -fsanitize=undefined -O0 -g -o parseint
    $ ./parseint -9223372036854775808
    parseint.c:38:23: runtime error: negation of -9223372036854775808 cannot be represented in type 'long long'; cast to an unsigned type to negate this value to itself
    result: -9223372036854775808
edit: this is just to show that getting undefined behavior right is hard!

comment 3y ago · link · parent

Because gambling is a funnel that converts exposure into raw, unrefined, money, and sponsoring Godot has incredible value-to-money: naïve game developers generally have poor financial sense!

comment 3y ago · link · parent

Compile-time short circuiting is why https://https://ziglang.org[Zig] sucks. It means that code that is never called never goes through semantic analysis, which means that calling functions can expose latent compile errors.

I've gone back to C99. Sure, arrays aren't bounds checked, but I can write C so much faster than Zig that it doesn't matter.

comment 3y ago · link · parent

that's just because they're mining for what computers need to function: RLHF data.