C

Why Does Calloc Exist?

Nathaniel J. Smith on the purpose of calloc: When the operating system hands out memory to a process, it always zeros it out first, because otherwise our process would be able to peek at whatever detritus was left in that memory by the last process to use it, which might include, like, crypto keys, or embarrassing fanfiction. So that’s the first way that calloc cheats: when you call malloc to allocate a large buffer, then probably the memory will come from the operating system and already be zeroed, so there’s no need to call memset.

C · Calloc · Programming

Will Faught

1 minute

C’s Faults

A few nights ago while lying in bed I put together a list of things that I don’t like about C: Side effects Weak typing Breakable semantics Simple types Design tends to put many cases into one struct No first-class functions No overflow/sign checks No homoiconicity or metacircular evaluation Weak macros Numerous code styles and conventions No namespaces Memory management Incorrect arithmetic Compiler-driven development Implementation-defined behavior No inherent or safe concurrency Multiple character sets Eager evaluation Encourages monolithic design Separate declarations and definitions No cheap container types like lists or tuples built in Difficult to reason about Debugging is necessary and primitive Declaration order matters I began to think about what I would change to improve it while keeping it attractive to current users.

C · Technology

Will Faught

1 minute

C

I used C quite a bit in college. Now I use C++ at work, and now I can really appreciate the relative simplicity and elegance of C. C++ just smells. C# seems to be a synthesis of the best qualities of C and Java. One of the great absurdities of computation is how widespread C++ is.

C · C++ · Csharp · Technology

Will Faught

1 minute

π