News for hackers. Stuff that matters.
Re:A critique of "How to C in 2016" by DrJokepu on Friday January 15, 2016 @07:18AM (#10908796)
I mean, reading zeroed out memory is not really incorrect behaviour anyway. If you know that it was zeroed out, then you're really just reading memory that was initialised with a specific default value.

That being said, zeroing out everything you allocate will make it difficult for the kernel's paging system to defer allocating you a physical page until you actually need it, so you will need to be a lot more careful with your allocations if your application uses relatively large amounts of memory and you need to work with memory constraints.

Re:A critique of "How to C in 2016" by rc4algorithm on Friday January 15, 2016 @09:22AM (#10909437)
Unless the zeroing is defined by the language, assuming it t is incorrect and shouldn't be done.
Re:A critique of "How to C in 2016" by lmm on Friday January 15, 2016 @10:28AM (#10909809)
Calloc is defined to return memory that's all-bits-zero, which in turn defines the value for many datatypes. The overwhelming majority of C implementations additionally define the values of all-bits-zero floats and pointers. IMO it's reasonable to write programs targeting only such implementations, provided such a dependency is clearly documented (just as e.g. it's reasonable to write C programs targeting only implementations on which floating-point arithmetic is IEEE 754, despite this not being required by the C standard).
Re:A critique of "How to C in 2016" by rc4algorithm on Friday January 15, 2016 @10:52AM (#10909990)
> The overwhelming majority of C implementations additionally define the values of all-bits-zero floats and pointers.

So... Clang and GCC?

Regardless, you're ignoring the obvious difference: that isn't POSIX- or ISO-defined at all. If you choose to use it, you're using a weird dialect. Might as well just switch to Cyclone.

Re:A critique of "How to C in 2016" by lmm on Friday January 15, 2016 @11:14AM (#10910171)
> that isn't POSIX- or ISO-defined at all. If you choose to use it, you're using a weird dialect.

People used C (even on multiple compilers) long before POSIX or ISO. You're putting the standardization cart before the compatibility horse.

Re:A critique of "How to C in 2016" by rc4algorithm on Friday January 15, 2016 @12:10PM (#10910579)
Yeah, let's revert to 1988! Great solution! Muchly of advance!