3 ms·
C but with the following changes: - Guarantee 8-bit byte and twos complement - No undefined behavior. All behavior is defined even if the ramifications of tha
by torstenvl 4y ago
C but with the following changes:
- Guarantee 8-bit byte and twos complement
- No undefined behavior. All behavior is defined even if the ramifications of that behavior are not. Use after free? The data in the memory location is written-to or read-from, not omitted by compiler, and programmer is responsible for the second- and third-order effects thereof. Signed integer overflow? You get the assembly ADD instruction for your platform/data width and see what happens.
- Fixed width integers. int8_t == short short int. int16_t == short int. int32_t == int. int64_t == long int. int128_t == long long int.
- char is by default always unsigned.
- byte type similar to unsigned char but requires explicit cast.
- Anonymous functions well-supported.
- A method keyword inside a struct defines a function pointer to an anonymous function with the signature and definition that follows.
- New operator --> such that x-->y(...) is equivalent to y(x, ...) (perhaps with additional error checks)
- Arrays no longer degrade to pointers but to fat pointers with an aligned prefix sds-style. Argument syntax for an array/fat pointer is arg[..]
- char type used alone is deprecated
- string type is an array/fat pointer of type char[..]
- str* functions deprecated; now that unique identifiers can use more than the first six characters, use string* functions instead
- "C" locale defined as using UTF-8 normalized to NFC
- Conforming change: allowable main() signatures include int main(string argv[..])
- scrubs 4y agoWell, let's baseline with Zig. Because that adds build dependency management. Building code has got to work like GO: it needs to be built into the compiler. Let's also add formal methods that's bound up with the implementation language even if it starts 1-way from FM to code. Correctness in any of its several dimensions would be better with pragmatic FM together with the code itself. Zig, which deals with C/C++ code, has the ultimately eco-system. That's a big plus.
- deleted 4y ago[deleted]
- benj111 4y agoAs a non professional programmer the thing that i don't like about zig is it tries to make you do the right thing. I like playing around with the side effects of things, abusing pointers etc. It isn't safe, it isn't sensible but I'm not aiming to do safe sensible things.
- benj111 4y agoAnd function prefixes for external libraries so you know where they've come from.