wchar_t,char16_t,char32_t用于拓展字符集 char和signed char并不一样,由编译器决定类型char表现上述两种中的哪一种 一般long的大小和int无二,如果超过int的范围直接使用long long类型 float比较鸡肋,精度和速度都不如double(在某些机器上),所以小数索性都用double 若值超过无符号类型最大值,则获得的实际值=value%MaxValueOfType:若值超过有符号类型最大值,结果无法预知 算数表达式中若存在无符号类型,则其他运算…
Getting Started compile C++ program source $ g++ -o prog grog1.cc run C++ program $ ./prog The library, iostream, define four IO object: cin, cout, cerr, clog. std::cout << "hello world" << std::endl; The result of the output operato…
1. Type conversion: If we assign an out-of-range value to an object of unsigned type, the result is the remainder of the value modulo the number of values the target type can hold. If we assign an out-of-range value to an object of signed type, the r…
这阵子真是太忙了, 连续做了四个课设. 当然这并不能作为好久没写博客的借口, 没写博客的主要原因只有一个: 懒. 最近又开始回顾C++的语法与特性(据说C++就是一门需要反复回顾的语言),以及学习C++的编程规范. 敲了C++Primer 5th 上的一道典型的练习题,纪念一下这即将过去的2016. 题目描述: 定义你自己版本的 StrBlobPtr, 更新 StrBlob类, 加入恰当的 friend 声明及begin 和 end 成员. 这道题目主要是练习 智能指针 share_ptr 和…
基础数据类型(Basic Types) 为了搭建应用程序,我们需要使用一些基础数据类型比如:numbers,strings,structures,boolean等等. 在TypeScript中除了JavaScript现有的常见的数据类型外还有一个非常实用的枚举类型(enumeration type). Boolean 最基础的数据类型莫过于只有true和false的布尔类型了,在TypeScript,JavaScript以及其它的很多数程序语言中我们使用关键字'boolean'. var isD…
Go's basic types are bool string int int8 int16 int32 int64 uint uint8 uint16 uint32 uint64 uintptr byte // alias for uint8 rune // alias for int32 // represents a Unicode code point float32 float64 complex64 complex128 package main import ( "fmt&quo…
我们常常会定义自己工程用的数据类型,可能会与Windows的基本数据类型冲突. vs会报重复定义错误:error C2371: 'SIZE' : redefinition; different basic types 解决方法:欺骗编译器 #define SIZE wSIZE typedef long SIZE; #undef SIZE typedef int SIZE; int _tmain(int argc, _TCHAR* argv[]) { SIZE n = 0; //SIZE = in…
  QML入门教程(1) QML是什么? QML是一种描述性的脚本语言,文件格式以.qml结尾.语法格式非常像CSS(参考后文具体例子),但又支持javacript形式的编程控制.它结合了QtDesigner UI和QtScript的优点.QtDesigner可以设计出.ui界面文件,但是不支持和Qt原生C++代码的交互.QtScript可以和Qt原生代码进行交互,但是有一个缺点,如果要在脚本中创建一个继承于QObject的图形对象非常不方便,只能在Qt代码中创建图形对象,然后从 QtScrip…
这几天看了C++ primer 5th的一二章,有很多收获,但是有的地方因为翻译的问题也搞得理解起来颇为难受啊啊啊啊.尤其是const限定符,在C语言并没有这么多复杂的语法,在C++里面语法细节就多的不行. 顺便做了两张思维导图 思维导图 细节补充 第一章 这一章没什么好说的,主要介绍了顺序选择循环三种基本语句,输入输出流的概念,注释,ADT(抽象数据类型)的概念初识和类的简单介绍. 由于有C语言的数据结构的基础,所以除了C++自带输入输出流似乎也没什么可说的. 1.iostream 标准输入输…
We can create the most basic components of our GraphQL Schema using GraphQL's Object Types. These types allow us to group related fields together under a specific type, such as a Video or a User, and then allows us to fetch these types when we query…