News for hackers. Stuff that matters.
Re:How to C in 2016 by AndyKelley on Friday January 08, 2016 @07:54AM (#10864498)
The author linked to this site: https://www.securecoding.cert.org/confluence/display/c/SEI+C...

These are wonderful. Concise nuggets of knowledge that you can keep in your head, little warnings of what not to do.

Side note, it's really fun reading this article about modern C given that I'm working on an experimental programming language meant to replace C [1]. Just today I got the Guess Number Game example working, without a dependency on libc [2] (caveat: Linux x86_64 only so far). So, I'm having fun trying to think about how C could be better, reading implementations of various libc functions, and writing my own "standard library".

For example, in my language, there are no `int`, `unsigned char`, `short` types, there are only `i32`, `u8`, `i16`, etc (I shamelessly stole this idea from Rust). This mirrors the article's suggestion to only use int32_t, uint8_t, int16_t, etc. But, since it's a new programming language, we don't have the other types sitting there as a red herring.

[1]: https://github.com/andrewrk/zig

[2]: https://gist.github.com/andrewrk/131e6f48a15c42fc5ca8

Re:How to C in 2016 by ilek on Friday January 08, 2016 @08:42AM (#10864723)
>only `i32`, `u8`, `i16`

While these are not new ideas - Why not use s32 rather than i32 and so on. Makes more sense if you use something like u32 too.

I think it's important when making another language to really question everything you do in it. Why use this operator, or why use this mnemonic for built in types?

Re:How to C in 2016 by masklinn on Friday January 08, 2016 @10:21AM (#10865444)
> While these are not new ideas - Why not use s32 rather than i32 and so on. Makes more sense if you use something like u32 too.

i denotes an integral, as opposed to the also-signed float types?

Re:How to C in 2016 by WalterBright on Friday January 08, 2016 @08:14AM (#10864592)
> there are only `i32`, `u8`, `i16`, etc (I shamelessly stole this idea from Rust).

Those are very old ideas.

Re:How to C in 2016 by kibwen on Saturday January 09, 2016 @08:56AM (#10871241)
And Rust stole them from very old languages, but you haven't at all refuted the author's statement. :P