Problems of C, and how Zig addresses them
avestura.dev
Problems of C, and how Zig addresses them
1–10 of 290 posts
Re: Problems of C, and how Zig addresses them
#2Re: Problems of C, and how Zig addresses them
#3Re: Problems of C, and how Zig addresses them
#4const x: i16 = -1 * 32768; // valid
In the text it's i32
Re: Problems of C, and how Zig addresses them
#5Re: Problems of C, and how Zig addresses them
#6Re: Problems of C, and how Zig addresses them
#7I imagine if I had more experience in Zig, none of that would be a problem, and its not aiming to be a beginner-friendly language anyway, but that was just my experience of it so far
Re: Problems of C, and how Zig addresses them
#8I'm no expert on either languages, but I tried Zig for the first time properly the other day. I really liked it up until I hit hashmaps. One thing that I think goes under-appreciated about C (and other languages with a similar paradigm) is thats its pretty upfront and clear about what it can and can't do out of the box. If you want hashmaps in C, you need to create your own implementation, otherwise think of a way ro…
Re: Problems of C, and how Zig addresses them
#9 var arr = [_]u32{ 1, 2, 3, 4, 5, 6 }; // 1, 2, 3, 4, 5, 6
const slice1 = arr[1..5]; // 2, 3, 4, 5
const slice2 = slice1[1..3];
If I were to use indices out of range, presumably that would that give me a compile time error? Could I use variables as the indices and, if so, could I get a seg fault at runtime or are there some sort of guards on there?Re: Problems of C, and how Zig addresses them
#10I'm no expert on either languages, but I tried Zig for the first time properly the other day. I really liked it up until I hit hashmaps. One thing that I think goes under-appreciated about C (and other languages with a similar paradigm) is thats its pretty upfront and clear about what it can and can't do out of the box. If you want hashmaps in C, you need to create your own implementation, otherwise think of a way ro…