127 private links
People seem to think that writing a garbage collector is really hard, a deep magic understood by a few great sages and Hans Boehm (et al). Well it’s not. In fact, it’s rather straight forward. I claim that the hardest part in writing a GC is writing the memory allocator, which is as hard to write as it is to look up the malloc example in K&R.
The art of good programming depends upon the discipline of the programmer, no matter what language is being used. The purpose of object oriented programming (OOP) is to produce well designed reusable code. In principle OOP can be done in any language, even assembly. This is because all OO language compilers/assemblers (e.g. C++) ultimately translate the high level constructs of the language into machine language. Thus there is a mapping from an object oriented semantics onto the instruction and data arrays that are executable images.
Here we will present a design and implementation method for producing OO code in the C language. It turns out that using this methodology will strongly improve your overall program design and implementation just as you expect when programming in a native OO language like Java or C++. When working in C, however, the discipline applied to producing good designs comes from the programmer and not from the language itself.
Ah, C. Still the language of modern high-performance computing.
C is the lowest-level language most programmers will ever use, but it more than makes up for it with raw speed. Just be aware of its manual memory management and C will take you as far as you need to go.
The open source, decentralized and multi-platform package manager to create and share all your native binaries.
Why on earth would someone would pick C to start a new project in 2020? Surely there is a newer language with more shiny features that’s better right? Well I can’t speak for other people but I’ll tell you my reasons.
First of all let me preface this by saying that of course this is a biased opinion and the language I pick for something depends on the context it’s going to be used in. For example; I doubt I’ll ever be reaching for C when writing a web service simply because the ecosystem around that domain isn’t great and I’m not itching to write my http framework at this time.
But for games, more specifically cross-platform games C is a clear winner for me because it provides me with exactly the things I’m looking for which is reliability, simplicity and performance.
The C language is still prominent in the industrial embedded world, where “IoT” often refers to platforms much more limited than a Raspberry Pi. Often having to deal with such environments, we wrote the following informal explainer about C for internal company needs, and thought it could be of interest for more readers. This is basic material, mixing C and operating systems knowledge, aimed at readers with no or limited understanding of how you go from C source code to an executable. We could expand on many points, but for now we just share this meandering overview.
When something very basic goes wrong, I have this hierarchy of potential culprits:
- the compiler
- buggy hardware
- OS vendor
- last and least me, because I don’t make mistakes :)
So what doesn’t work ? I am doing a simple cast from a floating point value to an integer value in C. This happens in a routine, that checks, if a double is integral and if it would fit into a long.
When you learn c, you gain a basic understanding of the flow of these languages and how they run, though all of them bring some or the other changes which make them unique. So, if you’re interested in programming, C is a great place to start.
Any C structure can be stored in a hash table using uthash. Just add a UT_hash_handle to the structure and choose one or more fields in your structure to act as the key. Then use these macros to store, retrieve or delete items from the hash table.
si78c is a memory accurate reimplementation of the 1978 arcade game Space Invaders in C.
It requires the original arcade ROM to function to load various sprites and other data, but does not use the original game code.
It is not an emulation, but rather a restoration.
C∀ (C-for-all) is an open-source project extending ISO C with modern safety and productivity features, while still ensuring backwards compatibility with C and its programmers. C∀ is designed to have an orthogonal feature-set based closely on the C programming paradigm (non-object-oriented) and these features can be added incrementally to an existing C code-base allowing programmers to learn C∀ on an as-needed basis. In many ways, C∀ is to C as Scala is to Java, providing a research vehicle for new typing and control-flow capabilities on top of a highly popular programming language allowing immediate dissemination.
At Open Source Technology Summit (OSTS) 2019, Josh Triplett, a Principal Engineer at Intel gave an insight into what Intel is contributing to bring the most loved language, Rust to full parity with C.
A mini-preprocessor library to demostrate the recursive capabilites of the preprocessor.
If you spent a few years programming in C, you're probably much more confident about your knowledge of the language than if you spent as much time working with C++ or java.
Both the C language and its standard library are quite close to the smallest they could be.
The current most used version of the language, c99, brought a bunch of new features, many of which are completely unknown to most C programmers (Older specifications obviously also have some dark corners).
Here are the ones I know about.