Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to optimize C++ registers

Shulou Source: shulou.com Published: 2022-06-01 20:49:53 09月15日 Update

This article mainly explains "how to optimize C++ registers". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "how to optimize C++ registers"!

C++ register optimization

There is an interesting phenomenon in C++. Look at the code first.

# include

Using namespace std

Int main ()

{

Int const tmp = 100; / / definition constant tmp tmp cannot be modified

Int const* p = & tmp; / / the pointing value cannot be modified through the pointer

Int* const Q = const_cast (p); / / the unconstant attribute can modify the content of the point through the pointer

* Q = 200

Cout

Tags: Registers clocked variables points contents pointers results memory properties constants compilers compilers keywords keywords can pass address that is time learning utility Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information vpn Xiaomi Huawei MySQL