c/c++基本数据类型转换
If either operand is of type long double, the other operand is converted to type long double.
If the above condition is not met and either operand is of type double, the other operand is converted to type double.
If the above two conditions are not met and either operand is of type float, the other operand is converted to type float.
//如果不是浮点数精度
If the above three conditions are not met (none of the operands are of floating types), then integral conversions are performed on the operands as follows:
If either operand is of type unsigned long, the other operand is converted to type unsigned long.
If the above condition is not met and either operand is of type long and the other of type unsigned int, both operands are converted to type unsigned long.
If the above two conditions are not met, and either operand is of type long, the other operand is converted to type long.
If the above three conditions are not met, and either operand is of type unsigned int, the other operand is converted to type unsigned int.
If none of the above conditions are met, both operands are converted to type int.
- 二元运算不考虑枚举的话,如果两边类型不一样,且有一边是浮点类型,则两边都转换成等级更高的浮点类型。否则两边进行integral promotion,然后如果两边类型不一样且同是signed或者同是unsigned,等级低的类型转换成等级高的类型。否则如果unsigned一边等级高于或等于signed一边,signed那边转换成unsigned那边的类型。否则如果signed那边的类型能容纳unsigned那边的范围,unsigned那边转换成signed那边的类型。否则两边都转换成signed那边对应的unsigned类型。
c/c++基本数据类型转换的更多相关文章
- 关于Java中的基本数据类型转换
Java中的基本类型有四种,其中整型分为byte.short.int.long,浮点型分为float.double,字符型char,布尔型boolean.8种类型的级别由低到高byte->sho ...
- java变量的作用域和基本数据类型转换
1.变量的作用域 赋值运算符 变量名 = 表达式 列: a = (b+3)+(b-1) 表达式就是符号(如:加号,减号)与操作数(如:b,3)的组合 自动类型转换(隐式类型转换):从小类型到大类型可以 ...
- 彻底理解Java中的基本数据类型转换(自动、强制、提升)
说基本数据类型转换之前,先了解下 Java 中的 8 种基本数据类型,以及它们的占内存的容量大小和表示的范围,如下图所示. 重新温故了下原始数据类型,现在来解释下它们之间的转换关系. 自动类型转换 自 ...
- javascript 六种基本数据类型转换
javascript 六种基本数据类型转换 1.显式转换 通过手动进行类型转换,Javascript提供了以下转型函数: 转换为数值类型:Number(mix).parseInt(string,rad ...
- Java基本数据类型转换及运算符
上次我们说到完了Java中的基本数据类型,今天我们来说说Java中的基本数据类型转换和Java中的运算符 基本数据类型转换 java中可以从任意基本数据类型转型到外的基本数据类型 注意:(boolea ...
- JavaSE基础(十)--Java中的基本数据类型转换
Java中的基本数据类型转换 说基本数据类型转换之前,先了解下 Java 中的 8 种基本数据类型,以及它们的占内存的容量大小和表示的范围,如下图所示. 重新温故了下原始数据类型,现在来解释下它们之间 ...
- Java基本数据类型转换
一:Java的基本数据类型和引用数据类型 1:基本数据类型 2:引用数据类型 二:基本数据的类型转换 基本数据类型中,布尔类型boolean占有一个字节,由于其本身所代码的特殊含义,boolean类型 ...
- java基本数据类型转换成byte[]数组
import java.io.UnsupportedEncodingException; public class ConToByte { /** * double转换byte ...
- JAVA基本数据类型转换的注意事项
JAVA中基本数据类型: 类型: 字节: 范围: 默认值: byte 1 -128~127 0 short 2 -32768~32767 0 char 2 0~65535 '\u0000' int 4 ...
随机推荐
- 简单理解DNS解析流程(一)
0x0 简单理解dns DNS服务器里存着一张表 表中放着域名和IP地址,域名和IP地址以映射关系保存,即一对一 浏览器访问某个域名,实际上是访问它的ip地址 所以浏览器需要知道域名对应的ip地址 如 ...
- 金融科技行业 SDL(转载)
都是一些检查项,值得借鉴,关键在于要能够落地 作者 沈发挺@美的金融科技下载打印版
- 深入理解Java类加载器(ClassLoader) (转)
转自: http://blog.csdn.net/javazejian/article/details/73413292 关联文章: 深入理解Java类型信息(Class对象)与反射机制 深入理解Ja ...
- 最详细的springmvc-mybatis教程
链接:http://blog.csdn.net/qq598535550/article/details/51703190
- No.1001_第六次团队会议
黯淡的一日 今天发生了很令人不爽的一件事,杜正远又被叫去实验室了.昨天界面就很难做,而且我们组人手稀缺,他的缺席让我很难做下去. 今天开会我自己没做出什么来,就加了一个群组的添加功能,同样,曾哲昊也没 ...
- 实验二 Java面向对象程序化设计
实验二 Java面向对象程序设计 一. 实验要求 1.完成实验.撰写实验报告,以博客方式发表在博客园 2.实验报告重点是运行结果.遇到的问题(工具查找,安装,使用,程序的编辑,调试,运行等).解决办 ...
- 20172325 2016-2017-2 《Java程序设计》第四周学习总结
20172325 2016-2017-2 <Java程序设计>第四周学习总结 教材学习内容总结 1.对类.对象.声明变量的定义和属性有了进一步的了解 2.学会如何编写一个类并运用到需要的程 ...
- 26_多线程_第26天(Thread、线程创建、线程池)_讲义
今日内容介绍 1.多线程 2.线程池 01进程概念 A:进程概念 a:进程:进程指正在运行的程序.确切的来说,当一个程序进入内存运行, 即变成一个进程,进程是处于运行过程中的程序,并且具有一定独立功能 ...
- ucontext-人人都可以实现的简单协程库
ucontext的介绍 http://blog.csdn.net/qq910894904/article/details/41911175 协程的介绍 https://en.wikipedia.org ...
- lucene介绍
1.https://blog.csdn.net/shuaicihai/article/details/65111523 2.https://www.cnblogs.com/rodge-run/p/65 ...