C/C++

C

neither gcc nor clang are compliant with standard c++

in c++, function types have a "language linkage" associated with them: this is either "C++", "C", or some other implementation-defined language. and the standard very explicitly states that Two function types with different language linkages are distinct types even if they are otherwise identical...

Lobsters Lobsters · C/C++ ·
0
The Zilog Z80 has turned 50

The Zilog Z80 has turned 50

As of writing, the Zilog Z80 processor was officially launched 50 years ago, in July of 1976, less than 4 years after the last human had walked on the moon, decades closer to WWII than to the present day, roughly at a half way point between the Kennedy assassination and the...

Lobsters Lobsters · C/C++ · Assembly ·
0
Identifying JDK Value Class Candidates

Identifying JDK Value Class Candidates

As long as value classes are a preview feature, they can’t generally be adopted in the JDK libraries (which are not compiled with `--enable-preview`). However, we felt it was important for this JEP to provide users with a “starter kit” of some value classes out of the box, and to ease into any mi...

Inside Java Inside Java · C/C++ ·
0
C

a bunch of stuff i used to not know about K&R C

ok so i've been reading the "specification" from "the c programming language" (1st edition). alongside that, i've also been reading the c89 rationale document, and the source code for the 7th edition unix c compiler. i've also been reading some other related stuff.

Lobsters Lobsters · C/C++ ·
0
C

Beautiful Type Erasure with C++26 Reflection

If you’ve ever tried using type erasure for something more complicated than std::any or std::function, you’ve either written 100+ lines of easy-to-mess-up code or reached for a boilerplate-heavy library like Boost.TypeErasure or Folly.Poly. rjk::duck uses the magic that is C++26 reflection to rem...

Lobsters Lobsters · C/C++ ·
0
Make It Right - Next Steps With CTRAN

Make It Right - Next Steps With CTRAN

Let’s start with a quick recap for those of you who are just tuning in (and for those who have been tuned in for a while but are likely very lost): In the late 80s, Psion developed their own message-passing Object Oriented C dialect with its own markup language. They did this because Psion be Psi...

Lobsters Lobsters · C/C++ ·
0
C import overflows

C import overflows

Trying to port one of my projects to 0.16 but getting a failure on C import: src/main.zig:986:12: error: C import failed const tb = @cImport({ thread 111408 panic: integer overflow /usr/local/lib/zig/std/zig/ErrorBundle.zig:218:27: 0x123d049 in renderErrorMessage (build) s...

Ziggit Blog Ziggit Blog · C/C++ ·
0
C

2026 Field Trip: Dinosaur Center & Morrison, CO

The Cppcon 2026 Field Trip will be a visit to Morrison, Colorado – a town on the edge of the Rockies, famous for Red Rocks, the world renown music venue! No concerts are being held on September 13th, but that is a perfect opportunity to enjoy the scenery, town, and museums that Morrison has to of...

CppCon Blog CppCon Blog · C/C++ ·
0
C

C++: The Documentary

Sponsored by HRT and produced by CultRepo, C++: The Documentary is about to be released worldwide on YouTube on Thursday at 20:00 UTC. Click Notify me on the YouTube Premiere page to get a reminder when it goes live.

CppCon Blog CppCon Blog · C/C++ ·
0
Parsing IPv6 Addresses Crazily Fast with AVX-512

Parsing IPv6 Addresses Crazily Fast with AVX-512

Every machine connected to the Internet has an address called an IP address. Originally, these addresses were 32-bit integers (IPv4), giving a theoretical maximum of about four billion distinct addresses. We are all familiar with these addresses (e.g., 192.168.0.0). There was a big fuss about how...

Daniel Lemire Daniel Lemire · C/C++ ·
0
SIMD-accelerated integer-to-string conversion

SIMD-accelerated integer-to-string conversion

Converting a 64-bit integer to its decimal string representation is a mundane task that shows up everywhere: logging, JSON serialization, CSV output, debug prints, etc. In C++, you might use std::to_chars, sprintf, or some library routine. How do these functions work? At a high level, they repeat...

Daniel Lemire Daniel Lemire · C/C++ ·
0
C

Announcing the CppCon 2026 Tracks

CppCon continues to grow as a conference that reflects the full breadth of modern C++ practice. One of the ways we support that breadth is through dedicated tracks. These tracks highlight areas of sustained interest in the community and create space for deeper, more focused conversations.

CppCon Blog CppCon Blog · C/C++ ·
0
Checking multiplication overflow

Checking multiplication overflow

Suppose that x is a variable of an unsigned type. In C/C++, it could be of type size_t for example. You have an expression like 6 * x and you want to know whether 6 * x overflows. That is, you want to know if 6 * x exceeds the range of values that can … Continue reading Checking multiplication ov...

Daniel Lemire Daniel Lemire · C/C++ ·
0
You can beat the binary search

You can beat the binary search

We sometimes have to look for a value in a sorted array. The simplest algorithm consists in just going through the values one by one, until we encounter the value, or exhaust the array. We sometimes call this algorithm a linear search. In C++, you can get the desired effect with the std::find fun...

Daniel Lemire Daniel Lemire · C/C++ ·
0
The fastest way to match characters on ARM processors?

The fastest way to match characters on ARM processors?

Consider the following problem. Given a string, you must match all of the ASCII white-space characters (\t, \n, \r, and the space) and some characters important in JSON (:, ,, [, ], {, }). JSON is a text-based data format used for web services. A toy JSON document looks as follows. { "name": "Ali...

Daniel Lemire Daniel Lemire · C/C++ ·
0
A brief history of C/C++ programming languages

A brief history of C/C++ programming languages

Initially, we had languages like Fortran (1957), Pascal (1970), and C (1972). Fortran was designed for number crunching and scientific computing. Pascal was restrictive with respect to low-level access (it was deliberately "safe", as meant for teaching structured programming). So C won out as a l...

Daniel Lemire Daniel Lemire · C/C++ ·
0
Can your AI rewrite your code in assembly?

Can your AI rewrite your code in assembly?

Suppose you have several strings and you want to count the number of instances of the character ! in your strings. In C++, you might solve the problem as follows if you are an old-school programmer. size_t c = 0; for (const auto &str : strings) { c += std::count(str.begin(), str.end(), '!'); } Yo...

Daniel Lemire Daniel Lemire · Assembly · C/C++ ·
0
The Hidden Cost of Misalignment

The Hidden Cost of Misalignment

Most embedded developers use #pragma pack(1) to create portable binary record formats. But pack(1) forces the compiler to byte-decompose every field access – even perfectly aligned fields – resulting in 7x more operations on RISC-V, ARM, and Xtensa. This post shows the problem, the fix (packed +...

Interrupt Blog Interrupt Blog · C/C++ ·
0
C

Well-Typed.Com: Second pre-release of hs-bindgen

With heartfelt thanks to the many people who have already tried hs-bindgen and given us feedback, we have steadily been working towards the first official release (see Contributors for the full list). In case you missed the announcement of the first alpha, hs-bindgen is a tool for automatic const...

Planet Haskell Planet Haskell · C/C++ ·
0
How many branches can your CPU predict?

How many branches can your CPU predict?

Modern processors have the ability to execute many instructions per cycle, on a single core. To be able to execute many instructions per cycle in practice, processors predict branches. I have made the point over the years that modern CPUs have an incredible ability to predict branches. It makes b...

Daniel Lemire Daniel Lemire · C/C++ ·
0
C

hs-bindgen 0.1-alpha release

Well-Typed are delighted to announce a release preview of hs-bindgen, a tool for automatic Haskell binding generation from C header files. We hope to invite some feedback on this initial release and then publish the first “official” version 0.1 in a few weeks. No backwards incompatible changes ar...

0
Converting data to hexadecimal outputs quickly

Converting data to hexadecimal outputs quickly

Given any string of bytes, you can convert it to an hexadecimal string by mapping the least significant and the most significant 4 bits of byte to characters in 01...9A...F. There are more efficient techniques like base64, that map 3 bytes to 4 characters. However, hexadecimal outputs are easier...

Daniel Lemire Daniel Lemire · C/C++ ·
0
Converting floats to strings quickly

Converting floats to strings quickly

When serializing data to JSON, CSV or when logging, we convert numbers to strings. Floating-point numbers are stored in binary, but we need them as decimal strings. The first formally published algorithm is Steele and White's Dragon schemes (specifically Dragin2) in 1990. Since then, faster metho...

0
Improving the usability of C libraries in Swift

Improving the usability of C libraries in Swift

There are many interesting, useful, and fun C libraries in the software ecosystem. While one could go and rewrite these libraries in Swift, usually there is no need, because Swift provides direct interoperability with C. With a little setup, you can directly use existing C libraries from your Swi...

Swift.org Blog Swift.org Blog · C/C++ ·
0
A new way to call C from Java: how fast is it?

A new way to call C from Java: how fast is it?

Irrespective of your programming language of choice, calling C functions is often a necessity. For the longest time, the only standard way to call C was the Java Native Interface (JNI). But it was so painful that few dared to do it. I have heard it said that it was deliberately painful so that pe...

Daniel Lemire Daniel Lemire · C/C++ ·
0
How stagnant is CPU technology?

How stagnant is CPU technology?

Sometimes, people tell me that there is no more progress in CPU performance. Consider these three processors which had comparable prices at release time. The AMD Ryzen 7 9800X3D (Zen 5, with up to 5.3 GHz boost) was released in 2024. The AMD Ryzen 7 7800X3D (Zen 4, with up to 5.1 GHz boost) was …...

0
By how much does your memory allocator overallocate?

By how much does your memory allocator overallocate?

How much virtual memory does the following C++ expression allocate on the heap? new char[4096] The answer is at least 4 kibibytes but surely more. Firstly, each heap memory allocation requires some memory to keep track of what has been allocated. You are likely using 8 bytes or so of overhead tha...

Daniel Lemire Daniel Lemire · C/C++ ·
0
Performance trick : optimistic vs pessimistic checks

Performance trick : optimistic vs pessimistic checks

Strings in programming are often represented as arrays of 8-bit words. The string is ASCII if and only if all 8-bit words have their most significant bit unset. In other words, the byte values must be no larger than 127 (or 0x7F in hexadecimal). A decent C function to check that the string is ASC...

Daniel Lemire Daniel Lemire · C/C++ ·
0
Loading more…