Published: 31 Oct 2020 › Updated: 31 Oct 2020
Porting code written for old compiler to new compiler
Recently I installed newer version of Ubuntu Linux (20.04) and noticed it doesn't have GCC 6 anymore... I know my code compiled with GCC 7 already, but I was curious how much it would take to make it compile with GCC 8 or newer, and more recent versions of Clang.
GCC 7 to GCC 8
- Most important change is that for simple variable types, copying using memcpy() is now discouraged. Direct assignment should be used instead.
GCC 8 to GCC 9
- When returning a class that has same type as return type of a function, std::move() should not be explicitly used.
GCC 9 to GCC 10
- cstdint and stdexcept headers need to be explicitly included when using standard integer types or throwing run-time exceptions
GCC to Clang
- Clang use different options to disable warnings
- For example -Wlogical-op and -Wno-maybe-uninitialized are not supported
- Clang requires explicit copy constructor if there is copy assignment operator
- Clang requires explicit move constructor if there is move assignment operator
- Clang requires explicit virtual destructor, if class has virtual methods
- Clang requires "override" keyword for virtual methods that override existing method in derived class
Leave Porting code written for old compiler to new compiler to:
Read more #programming posts
Best Posts From Mika
We have not curated any of mtl1979's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From Mika
- How to use MyHeritage Family Tree Builder without subscribing...
- PayPal launches its own stablecoin PYUSD... Is it safe or not?
- Design limitations of responsive websites
- April 1st, 2023 marks end of mainstream support of Ubuntu 18.04
- Understanding the Ethereum London Revised scam...
- How to use PancakeSwap for creating trading pair, swapping, buying and selling tokens - Part 2
- How to use PancakeSwap for creating trading pair, swapping, buying and selling tokens - Part 1
- How to combat abuse of token bridges...
- Finnish food and drink company recalls potato chips due to potential overdose...
- Why it is bad idea to let Ubuntu upgrade Python to 3.10...
- How to avoid getting scammed with malicious token contracts
- Decentralized exchange or not?
- Corruption scandal revealed in Finnish judicial system
- Calculating Ethereum or Binance Smart Chain gas...
- Smart contract platforms start to fight against non-conforming token contracts...
- Recent trend on exchange hacking...
- How token scams work...
- Support for resolving wallet address using DNS
- Talleo adds support for compiling under FreeBSD and NetBSD.
- Overloading operators in namespaces