‹ BackHN Continuity

Thread

C++ Insights – See your source code with the eyes of a Compiler

172 points · 36 comments · rramadass

  1. f1shy · · focus · HN ↗
    I must be the only one who (while I like the tool) feel a little strange, somewhere between sad, angry, annoyed and disappointed (can’t really express it), that a language needs (or at least is of good use) such a tool.

    Like: I wish what is the first interpretation of my code to be obvious. Is not about advanced optimization, or nitty gritty compiler tricks, is about the language. This tool is useful in any C++ compiler. How did we end with such a complex language?

    I mean (sorry, very personal take) the programming language is for me a tool to help me think about a problem and its solution. In this era of LLM more than before, is not a tool to get the machine to do something, is a language for formalizing ideas, problems and solutions, like math. Should not be so obscure, that you need to be a lawyer to understand it, right? Or I am very much old and totally in the weeds with my ideas?

    1. jcelerier · · focus · HN ↗
      Which language do you think doesn't need it? For instance for me I wish I had such a tool whenever I used any interpreted or JIT language, to understand clearly to which semantics whatever is happening maps and how their respective front-end optimizes. Things as simple as "a" + "b" in JavaScript: are you sure you know how every js runtime maps it? Do they fold the strings as an optimization during parsing ? Do they preallocate a larger native string type and push? Do they just do something that ends up an equivalent of std::u16string("a") + std:: u16string("b")?
Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.