Recently, there have been a lot of discussions about saving on matches, how to bring one or another construction into move semantics, all sorts of problems of string concatenation using .reserve and row counters, etc.

Where is the border between the program developer and the compiler developer? What should an ordinary developer know about the language? After all, only developers of compilers need to read the entire standard and understand the various intricacies? Or it is impossible to program well in c ++ without reading the entire standard?

Those. what an ordinary programmer should know about, and what should he leave to developers of compilers and optimizers?

Closed due to the fact that it is necessary to reformulate the question so that it was possible to give an objectively correct answer by the participants of ixSci , Abyx , aleksandr barakin , Peter Olson , Sergey Snegirev Jul 20 '15 at 15:25 .

The question gives rise to endless debates and discussions based not on knowledge, but on opinions. To get an answer, rephrase your question so that it can be given an unambiguously correct answer, or delete the question altogether. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • 3
    A good master in any business must know his instrument thoroughly. I can not understand those who are trying to understand where the line where you need to stop. In my opinion this face does not exist. You should know everything you can. Otherwise, what kind of programmer are you? PS I voted for the closure of this issue as too wide. This is all boltology, there can be no answer. Want to chat - welcome to chat. - ixSci
  • It is a pity that the label Zen is not left. - VladD
  • one
    @VladD, it's Ruso. You need not "Zen", you need "clamps" - ixSci
  • @ixSci: “braces” do not bear a shade of contemplation :) And by the way, what shade do braces have? In isolation from politics. - VladD
  • @VladD, I do not know. In my opinion the same as Zen. Few people understand that this means that what is different and gives it exactly the meaning that is needed. Tipo stuff, thing and issue from the bourgeois dialect - ixSci

1 answer 1

It seems to me that there is no single bound. Many things can be improved to infinity. For example, the same copies can be optimized with the help of move-semantics, calculations can be brought to the compilation stage with the help of “template magic”, the costs of concatenation can be bypassed by reserving memory in advance. In part, this is a problem of language and “holey” abstractions, and in part, not a smart optimizer.

Each sets its own boundaries based on its aesthetic preferences and practical tasks. For example, if the code is a business logic, then low-level optimizations in it look out of place, and also complicate and slow down development in an unnecessary way.

Since the language is large, programmers usually know only part of the overall picture that they come across during development. Those who deal with low-level code and bit-pressing are often poorly versed in the semantics of exceptions or there are multi-threading. Those who are engaged in lock-free-structures and know the memory model to the subtleties, may well float in matters of packing structures or patterned magic. And those who can calculate md5 at compile time may well be unaware of the internal format and overhead of multiple inheritance or float in details name resolution.

The C ++ language tends to a great emphasis on "small" efficiency, so it seems to me that, developing on it, it is worthwhile to pay more attention to such optimizations.