Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the basic principles of C++

2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "what are the basic principles of C++". In daily operation, I believe many people have doubts about what the basic principles of C++ are. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer your doubts about "what are the basic principles of C++?" Next, please follow the editor to study!

P: Philosophy (basic principles)

The rules in this section are very general.

The rules in this partition are general and universally applicable.

Philosophy rules summary:

A list of basic principles:

P.1: Express ideas directly in code

Express ideas directly in code

P.2: Write in ISO Standard C++

Write code using the ISO standard C++

P.3: Express intent

Interpretive intention

P.4: Ideally, a program should be statically type safe

Ideally, the program should be type-safe

P.5: Prefer compile-time checking to run-time checking

Compile-time checks are better than execution-time checks

P.6: What cannot be checked at compile time should be checkable at run time

Cannot be checked at compile time, it should be checked at execution time

P.7: Catch run-time errors early

Catch execution errors as early as possible

P.8: Don't leak any resources

No resource leaks.

P.9: Don't waste time or space

Don't waste time and space.

P.10: Prefer immutable data to mutable data

Immutable data is better than variable data.

P.11: Encapsulate messy constructs, rather than spreading through the code

Compress messy constructs instead of spreading them through code

P.12: Use supporting tools as appropriate

Proper use of support tools

P.13: Use support libraries as appropriate

Proper use of support libraries

Philosophical rules are generally not mechanically checkable. However, individual rules reflecting these philosophical themes are. Without a philosophical basis, the more concrete/specific/checkable rules lack rationale.

Basic principles are not usually mechanically inspectable. However, separate rules that reflect these basic principles are inspectable. Without basic principles as the basis, more specific / special / inspectable rules will lack basis.

Translator's note: the so-called mechanical inspection should refer to the use of inspection software to check through the rules.

At this point, the study of "what are the basic principles of C++" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report