We are proud to announce Buckaroo v2.0.0!

Buckaroo has been re-architected to accommodate the lessons learned from v1.x, incorporate your feedback and close more than 85 issues in the process.

We also removed 17k lines of Java code and replaced it with 8k of F#! 🙌

Here are the key points…

Live at Head — Depend on Moving Branches & Tags

You can now treat Git branches & tags as versions too!

Thanks to our locking mechanism, we ensure that the installation is reproducible even if the branch or tag is updated. When you are ready to move to the next version, just do buckaroo upgrade.

Upgrade Bot and Patch…


“person flip skiing above snow during daytime” by Jörg Angeli on Unsplash

Many people look at the Coroutines TS and wonder, what is all of the fuss about?

This article gives you one motivating example where lazy sequences enable you to seperate your concerns and maximize code reuse without increasing complexity.

Example: Approximating the Golden Ratio

Every Math student knows how to approximate the golden ratio via the Fibonacci series:

fib(n+1) / fib(n) -> φ = 1.6180… 

Or using C++…

The function golden computes the golden ratio to a given approximation. On each iteration we get a little bit closer to the golden ratio, and the function returns once we are close enough.

This was straightforward…


“blue building block lot” by Iker Urteaga on Unsplash

Make is a conceptually simple build-system, and it is packaged with major Linux distributions. However, Make should rarely be your build-system of choice when starting a new C++ project.

That’s a bold claim, so here’s why…

The dependency graph of a C++ library is actually quite complex. It must be rebuilt every time a linked object-file changes… But an object-file should be rebuilt every time its translation-unit changes, or the compilation flags change, or if any of its included headers change, or if the compiler changes…

You can query this information using the compiler and encode all of this in…


“black swirl of letters” by Nathaniel Shuman on Unsplash

C++ has evolved massively in recent years and yet it is still perceived by many as the language that it was back in the early 2000s. Let’s dispel some myths…

C++ is actually growing! Even as computers becomes faster, our demands of what we want to do with them are always increasing. C++ is one of the few languages that allows us to maximize the potential of our hardware.

Stroustrup’s talk from CPP Con shows C++ on a growth trajectory.

With the new auto keyword and lambda syntax, C++ can be correct, fast and concise.

For example, compare these…


Conduit is a new library that leverages the Coroutine TS to introduce lazy sequences to C++.

Lazy sequences are an idea that’s very popular in the functional-programming community, but less common in the C++ world.

Simply put, a lazy sequence is one where the elements are computed as they are requested, rather than in advance.

This can lead to big efficiency gains since you only perform the computation required. It also allows you to represent infinite sequences, which of course could never fit into a vector!

Let’s see how Conduit works with some simple examples…

Square Numbers

Everyone is familiar with square…


“cube white block lot on gray surface” by Christian Fregnan on Unsplash

An integral part of any build-system is to detect what has changed and what needs to be rebuilt.

There are two approaches common approaches to this:

  • Compare timestamps between the output and input files. If the input files are newer than the output files, then a rebuild is required. Make works this way.
  • Compare the hashes of input files between runs. If the hashes have changed, then the output needs to be rebuilt. Buck, Bazel and SCons work this way.

Hash-based build-systems only rebuild an artefact if the hash of any of its input files have changed. …


“Why? signage near grass during daytime” by Ken Treloar on Unsplash

Excellent Precompiled Header Support

Most people have a love-hate relationship with precompiled headers (PCH). On the one hand, they can dramatically accelerate your build-times from scratch (30% is not unheard of), but on the other hand, they can have devastating effects on your incremental build-times.

Once in use, precompiled headers must be updated every time an included header changes. Now, every translation-unit that uses the PCH will also need to be recompiled, which may be far more often than necessary. PCHs effectively make every translation-unit depend on every header file in the PCH.

However, with Buck you can have the best of both worlds…


Analyze, Visualize and Migrate Between Build-systems

Is your C++ build slow or unintelligible? We are currently looking for more case studies. If you are interested in improving your Linux-based build (commercial or open-source), please get in touch!

https://buildinfer.loopperfect.com/

The C++ community is fragmented due to the variety of build-systems used. This fragmentation makes it difficult to:

  • Understand how a third-party library works
  • Integrate two libraries together
  • Optimize across libraries (e.g. LTO)
  • Build tooling for C++ source-code (where are the headers?)
  • Implement artefact caching
  • Identify which steps in the build process are slowing you down

For the C++ community this means:

  • Time wasted gluing projects together
  • Time…


Photo by Toa Heftiba on Unsplash

Introduction

In C++, nothing prevents the programmer from including a header-file multiple times. This can cause a duplication of definitions, which is an error. Since it is difficult to ensure that a header-file is only included once, a common strategy is to make only the first include count. This can be done using an “include guard”, a small piece of preprocessor logic that looks like this:

On the first include, HEADER_HAS_BEEN_INCLUDED is not defined, so we define foo. On subsequent includes, HEADER_HAS_BEEN_INCLUDED has been defined, so we just skip the content.

For example, if we have this C++ file:


TL;DR

Use Buck to generate a single-include header file for your library. This provides your users with an option for rapid development, which can be optimized later. Take a look at a working example on GitHub.

Introduction

A common pattern in C++ libraries is to provide a header file that includes all of the other header files in that library.

For example, suppose we have a library with these headers:

To use the library, we need to include each header file that we require:

Alternatively, the library designer can provide a single-include header that does all of this for us:

Buckaroo - C/C++ Package Manager

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store