📜 ⬆️ ⬇️

Error messages + templates: some simple tips

Little lyrics

I must immediately warn that this topic is hardly useful to programmers who are friends with C ++ for a long time and firmly. My goal is to help those who, when using other people's libraries with a large number of template, fall into a slight panic at the sight of error messages. As practice shows, often everything is not at all as scary as it looks and quite helps to understand what the problem is.

The idea to write a similar note arose in the process of writing a program that actively uses Boost :: Spirit2 - a complex grammar, an abundance of semantic action, the creation of an AST through an attribute value and so on. At some point I noticed that one or two minutes would be enough for me to correct many errors, while at the beginning of work on a project in similar cases, it could take up to an hour to analyze the situation.

Everything is written on the basis of working with gcc, but I think it will not be difficult to draw an analogy with the% compiler_name used &.
It's time to share!

What will help us?

After I stopped looking at the next error message in horror, and immediately began to dissect in these simple ways, the debugging time was reduced by an order of magnitude. What you want.

What tricks do you use? I would be glad to read in the comments tips on the topic. I propose to deal with the drawbacks of C ++ design collectively.

Source: https://habr.com/ru/post/102173/

All Articles