[c++] Basic ideas and Style Guide
Get your own compiler:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install g++-4.9
you can then compile using the command:
g++-4.9 -std=c++14 -Wall -Werror -O2 -o helloworld helloworld.cpp
Style Rules:
Macros should never be required in C++.
Variables should be defined close to their use.
Don’t use malloc/realloc, use new (or smart pointers)
Minimise use of void*, pointer arithmetic, union and c-style casts
Minimise the use of C-style arrays and strings, use vector/array (from C++11) and string instead.
总之,忘掉C语言。
C++ Standard Library
For efficiency reasons, STL is not object-oriented:
- Makes little use of inheritance, and
- Makes no use of virtual functions
The Standard Template Library (STL) is a part of the C++ standard library, Some others are:
分类一:
- The C standard library
- Language support: <exception>, <ctime>, ...
- Strings: <string>, <cstring>, ...
- Numerics: <cmath>, <complex>, ...
- I/O: <iostream>, <fstream>, <cstdio>, ...
- Exception classes
- Smart pointers
- Classes for internationalisation support
分类二:
Containers: vector, list, stack, ...
Algorithms: find, sort, copy, ...
Iterators are the glue between the two!
The compilation process:
1. Preprocessing - handles meta-information (e.g., #include)
2. Compiling - translates C++ into machine code objects
3. Linking - merges objects into a single application
对语言风格的实践就是最好的学习路径。明白了作者的风格定义思路,也就意味着语言学习达到了优良水准。
路漫漫其修远兮…… 除了坚持,没有捷径。Good luck!
[c++] Basic ideas and Style Guide的更多相关文章
- Google C++ Style Guide
Background C++ is one of the main development languages used by many of Google's open-source project ...
- Airbnb JavaScript Style Guide
Airbnb JavaScript Style Guide() { 用更合理的方式写 JavaScript ES5 的编码规范请查看版本一,版本二. 翻译自 Airbnb JavaScrip ...
- Dojo Style Guide
Contents: General Quick Reference Naming Conventions Specific Naming Conventions Files Variables Lay ...
- 与你相遇好幸运,The Moe Node.js Code Style Guide
The Moe Node.js Code Style Guide By 一个最萌的开发者 @2016.9.21 >>代码是人来阅读的,格式规范的代码是对编程人员最好的礼物 :) > ...
- 使用tdcss.js轻松制作自己的style guide
http://jakobloekke.github.io/tdcss.js/ 在前端开发中,如果能够有一个style guide对于设计来说就显得专业稳定,一致性.在上述链接中,有一个tdcss.js ...
- Google C++ Style Guide在C++11普及后的变化
转 http://www.cnblogs.com/chen3feng/p/5972967.html?from=timeline&isappinstalled=0&lwfrom=user ...
- Common Lisp Style Guide - Ariel Networks Labs
Common Lisp Style Guide - Ariel Networks Labs Common Lisp Style Guide
- 一张图总结Google C++编程规范(Google C++ Style Guide)
Google C++ Style Guide是一份不错的C++编码指南,我制作了一张比較全面的说明图,能够在短时间内高速掌握规范的重点内容.只是规范毕竟是人定的,记得活学活用.看图前别忘了阅读以下三条 ...
- PEP 8 – Style Guide for Python Code
原文:PEP 8 – Style Guide for Python Code PEP:8 题目:Python代码风格指南 作者:Guido van Rossum, www.yszx11.cnBarry ...
随机推荐
- Android中,图片分辨率适配总结规则drawable drawable-mdpi drawable-hdpi drawable-nodpi drawable-ldpi
一直关于android多分辨率适配有些疑惑,从网上找到一些资料并通过测试验证,参考链接:http://blog.csdn.net/lamp_zy/article/details/7686477 现记录 ...
- HDOJ 4749 Parade Show
说实在的在比赛时看错了题意,一直对最后一段的描述不是很清楚.闲话少说: 题意:给一个主串,再一个副串,问主串中有多少个子串和副串的的规律相同,即相邻的相等大于小于,用过的就不能再用了. #includ ...
- Sublime Text 3专题
MarkDown语法记笔记 1.下载&&安装 下载 常用插件安装 Submlit使用教程 [如何优雅地使用Sublime Text3] 2.Sublime Text 便捷技巧 [以PH ...
- seajs模块化作用理解(一句话)
seajs是js模块化的工具,主要大文件js不方便其他人理解,加载也较慢,seajs把各个功能模块分开,方便平行化开发,同时易于修改和理解,不用重复写功能需要时就应用 (有什么错误,请指正,缺少多谢补 ...
- js学习笔记之一
一.Javascript 中的对象 1. 建立自定义对象 方法1:对象={属性1:属性值1,属性2:属性值2……属性n:属性值n} 方法2:先定义构造函数,再new创建对象实例. 如: functio ...
- mysql5.6-5.7性能调优
1.DEFAULT_STORAGE_ENGINE 如果你已经在用MySQL 5.6或者5.7,并且你的数据表都是InnoDB,那么表示你已经设置好了.如果没有,确保把你的表转换为InnoDB并且设置d ...
- HK一行所见闻
香港一行 20多年来,未未去过HK,前段时间由于工作关系去了趟HK.感触良多. 一清早,福田过关,做火车,做地铁,一通到了目的地. 总结对那边的印象: 1,所有人都是粤语,包括工作交流.而且他们不怎么 ...
- ehcache基本使用
maven <dependency> <groupId>net.sf.ehcache</groupId> <artifactId>ehcache< ...
- 解决.NET Core中MailKit无法使用阿里云邮件推送服务的问题
在博问中(.net core怎么实现邮件发送)知道了MailKit无法使用阿里云邮件推送服务发送邮件的问题,自已实测也遇到同样的问题,而用自己搭建的邮件服务器没这个问题. 于是,向阿里云提交了工单.. ...
- 渣渣小本求职复习之路每天一博客系列——数据库基础(MySQL)(5)
前情回顾:昨天学习了MySQL中索引的设计与使用,还了解了一些常见的SQL注入攻击的手段以及防范方法,一般来说,在面试的时候如果不是要求比较高,基本就够用了. 今天碰见一个拿了TP-LINK的offe ...