News for hackers. Stuff that matters.
Re:Launch HN: Fuzzbuzz (YC W19) – Fuzzing as a Service by guidovranken on Wednesday February 27, 2019 @03:05PM (#19266465)
Some people use Protobufs to solve this, but when I work with C++, I use a class that takes a (data, size) as an input (to its constructor), and implements an overridable Get<T> method.

So you can do: auto s = datasource.Get<std::string>();

For each type I need I override Get<T> for that type. If the data source class is out of data, I throw a specific exception, that I catch at the global level. This works like a breeze and the advantage over protobufs is that it's faster (no Protobuf parsing overhead, errors) and you never consume more than you need.

There are no comments on this comment yet.