Bjarne Stroustrup: C++ Implementations - Clang, GCC, Microsoft, and EDG | Summary and Q&A

112.4K views
November 9, 2019
by
Lex Fridman
YouTube video player
Bjarne Stroustrup: C++ Implementations - Clang, GCC, Microsoft, and EDG

TL;DR

Having multiple implementations of C++ allows for flexibility, competition, and innovation in the programming language.

Install to Summarize YouTube Videos and Get Transcripts

Key Insights

  • 🥺 C++ was designed to accommodate various compilers, linkers, and operating systems, leading to multiple implementations.
  • ❓ Multiple implementations prevent a stagnant monoculture and promote innovation and competition.
  • 🐎 Competition among implementations drives improvements in standards compliance, performance, error messages, and compile time speed.
  • 👻 The availability of multiple implementations allows for flexibility and utilization of existing backend infrastructure.
  • 🎰 Different machines and architectures require distinct implementations due to their diverse characteristics.
  • ❤️‍🩹 C++ has four main front ends: Clang, GCC, Microsoft, and EDG.
  • ❓ Monocultures are dangerous as they inhibit competition and innovation.

Transcript

it says there differences in your view not saying which is better or so on but difference in the different implementations of C++ why are there several sort of money of you naive questions for me GCC clang so this is a very reasonable question when I designed C++ most languages have multiple implementations because if you wanna I p.m. if you run on... Read More

Questions & Answers

Q: Why are there multiple implementations of C++?

Multiple implementations of C++ exist due to the diverse compilation structures, linkers, and operating systems used by different companies. It was assumed that other companies would develop their own compilers for C++ alongside the initial implementation.

Q: How many front ends and backends for C++ implementations are there?

Currently, there are at least four different front ends for C++: Clang, GCC, Microsoft, and EDG. The backends vary significantly depending on the machine architecture and embedded systems being used.

Q: What are the advantages of having multiple implementations of C++?

Multiple implementations allow for competition, preventing a stagnant monoculture. Competition encourages innovation, better standards compliance, and performance improvements. It also creates an incentive for resolving issues such as error messages and compile time speed.

Q: Has there been any attempt to create a new C++ compiler from scratch?

There have been attempts to develop new C++ compilers, some of which have been utilized and integrated into existing implementations. Given the frequent updates and advancements in the C++ language, it is likely that more attempts will be made in the future.

Q: Why are there multiple implementations of C++?

Multiple implementations of C++ exist due to the diverse compilation structures, linkers, and operating systems used by different companies. It was assumed that other companies would develop their own compilers for C++ alongside the initial implementation.

Q: How many front ends and backends for C++ implementations are there?

Currently, there are at least four different front ends for C++: Clang, GCC, Microsoft, and EDG. The backends vary significantly depending on the machine architecture and embedded systems being used.

More Insights

  • C++ was designed to accommodate various compilers, linkers, and operating systems, leading to multiple implementations.

  • Multiple implementations prevent a stagnant monoculture and promote innovation and competition.

  • Competition among implementations drives improvements in standards compliance, performance, error messages, and compile time speed.

  • The availability of multiple implementations allows for flexibility and utilization of existing backend infrastructure.

  • Different machines and architectures require distinct implementations due to their diverse characteristics.

  • C++ has four main front ends: Clang, GCC, Microsoft, and EDG.

  • Monocultures are dangerous as they inhibit competition and innovation.

  • Attempts have been made to create new C++ compilers from scratch, with some being successful.

Summary

In this video, Bjarne Stroustrup discusses the reason behind having multiple implementations of C++. He explains that when he designed C++, he anticipated that there would be various implementations due to the different compilation structures and backend infrastructure of different companies. Additionally, he wanted to avoid a monoculture, as it can hinder innovation and incentivize resisting change. Currently, there are four main front ends for C++ - Clang, GCC, Microsoft, and EDG, along with numerous backends to support different architectures and systems. Stroustrup believes that competition among implementations leads to better standards compliance, improved performance, and overall better development experience. He also mentions that there have been attempts at creating new C++ compilers, some of which have been successfully used or absorbed by existing implementations.

Questions & Answers

Q: Why are there several implementations of C++?

When Bjarne Stroustrup designed C++, he anticipated the need for multiple implementations due to the varied compilation structures and backend infrastructures of different companies. He wanted to utilize the existing infrastructure, ensuring that C++ could run on different systems. Additionally, he wanted to avoid a monoculture, which can stifle innovation and resist change.

Q: How many front ends for C++ are there currently?

There are four main front ends for C++ - Clang, GCC, Microsoft, and EDG. These front ends are developed and maintained by different organizations and serve different purposes within the C++ ecosystem.

Q: Why are there different linkers for C++?

Bjarne Stroustrup realized that his users were using a wide range of linkers, and he couldn't write 25 linkers and still have time to work on the language. Therefore, he relied on the existing linkers available for different systems. This decision was not a deliberate choice to have multiple linkers; it was driven by the fact that different companies and systems had their own linker implementations.

Q: How many backends are there for C++?

The number of backends for C++ is significant and can vary depending on the architectures and systems being targeted. It is difficult to know the exact number, but there are numerous backends supporting different machines, particularly in the embedded systems industry. The variety of backends is necessary to accommodate the diverse architectures and requirements of different systems.

Q: What are the benefits of having multiple front ends for C++?

Multiple front ends for C++ introduce competition, which leads to improvements in various aspects of the language. Competition among front ends drives better adherence to standards, encourages performance optimization, enhances error messages, and can result in faster compile times. Having multiple options also prevents a single implementation from dominating the industry, encouraging innovation and incentivizing each front end to continually improve.

Q: Are there risks associated with having multiple implementations of C++?

Bjarne Stroustrup acknowledges that monocultures can be dangerous since the dominant implementer might become complacent and resist change. By having multiple implementations, the C++ community ensures that no single entity holds complete control over the language. This prevents stagnation and encourages a healthy ecosystem of competing implementations.

Q: Is it possible to write a new implementation of C++ from scratch?

Yes, it is possible to write a new implementation of C++ from scratch. In fact, there have been attempts to create new C++ compilers in the past. Some of these attempts have been successful and have been used alongside existing implementations, while others have been absorbed by established implementations. Given the progress made in C++ with each new standard (e.g., C++11, C++14, C++17, C++20), it is likely that someone will attempt to create a new implementation in the future.

Q: What are the advantages of writing a new implementation of C++ today?

Writing a new implementation of C++ today provides an opportunity to leverage all the advancements and improvements made in the language since its inception. With each new standard, C++ has evolved and incorporated new features, optimizations, and best practices. A new implementation can incorporate these advancements from the start, potentially resulting in more efficient, modern, and user-friendly tooling.

Q: How does competition among implementations affect the C++ ecosystem?

Competition among implementations is beneficial for the C++ ecosystem as it promotes continuous improvement and drives innovation. Each front end strives to outperform its competitors in terms of standards compliance, performance, error messages, and compile time speed. This competition raises the bar for all implementations, resulting in more robust and feature-rich tools for C++ developers.

Q: What impact does having multiple C++ implementations have on standardization?

The presence of various C++ implementations puts pressure on standardization committees to ensure consistency and compatibility across implementations. With multiple front ends scrutinizing the language specifications, any ambiguities or inconsistencies are more likely to be identified and resolved. It encourages the standardization process to be more thorough and comprehensive, ultimately leading to a better-defined and more reliable language standard.

Takeaways

Having multiple implementations of C++ is a result of the diverse compilation structures, backend infrastructures, and requirements of different companies and systems. Multiple front ends and backends introduce healthy competition, driving improvements in standards compliance, performance, error messages, and compile time speed. Avoiding a monoculture prevents stagnation and encourages innovation within the C++ ecosystem. Writing a new implementation of C++ provides an opportunity to incorporate all the advancements made in the language since its inception and can lead to more efficient and user-friendly tooling. The presence of multiple implementations also contributes to the standardization process, ensuring consistency and compatibility across different C++ implementations.

Summary & Key Takeaways

  • C++ was designed to have multiple implementations to accommodate different compilers, linkers, and operating systems used by various companies.

  • Multiple implementations ensure flexibility and availability of backend infrastructure without the need for creating custom tools for each.

  • Competition among implementations, such as GCC, Clang, and Microsoft, leads to continuous improvement, better standards compliance, performance, error messages, and compile time speed.

Share This Summary 📚

Summarize YouTube Videos and Get Video Transcripts with 1-Click

Download browser extensions on:

Explore More Summaries from Lex Fridman 📚

Summarize YouTube Videos and Get Video Transcripts with 1-Click

Download browser extensions on: