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 ...
随机推荐
- sqlmap 进阶 (一)
0x1 命令 以此类推,可以具体自己研究有哪些参数,放在哪,有什么用,怎么用 参考:https://blog.csdn.net/bo_mask/article/details/76130848 0x2 ...
- 记一次线上gc调优的过程
近期公司运营同学经常表示线上我们一个后台管理系统运行特别慢,而且经常出现504超时的情况.对于这种情况我们本能的认为可能是代码有性能问题,可能有死循环或者是数据库调用次数过多导致接口运行 ...
- MathExam6317
自己取一个大气又可爱的标题 小学二年级的还没来得及写,大部分时间还是花在巩固和查阅新旧知识上了,通过看学习视频,查资料,看博客园的博客...下次完善好了交上. 一.预估与实际 PSP2.1 Perso ...
- Struts2 核心流程
1.Struts2架构图 这是Struts2官方站点提供的Struts 2 的整体结构. 执行流程图 2.Struts2部分类介绍 这部分从Struts2参考文档中翻译就可以了. ActionM ...
- HDU 4568 Hunter 最短路+TSP
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=4568 Hunter Time Limit: 2000/1000 MS (Java/Others)Me ...
- 第三次作业---excel导入数据库及显示
好吧首先承认这次作业失败了,而且我并不知道原因.另外,我也没有采用PowerDesigner 设计所需要的数据库,代码就用了全部的时间.感觉自己就像一个刚学会爬着走路的小孩去参加一百一十米跨栏,能不能 ...
- 标头 header()函数的用法
头 (header) 是服务器以 HTTP 协议传 HTML 资料到浏览器前所送出的字串,在标头与 HTML 文件之间尚需空一行分隔. 范例一: 本例使浏览器重定向到 PHP 的官方网站. <? ...
- css border 制作三角形
border 边框 上三角 是只有上面的border 有颜色,其余的边框都是tranparents,下三角只有下面的border 有颜色,其余的边框都是tranparents,左三角只有左面的bord ...
- Pascal-S代码注释
注释参考博文 http://www.cnblogs.com/luxiaodou/p/6025124.html 注释代码 https://github.com/Hesitater/Pascal-S-Co ...
- [转帖]剖析淘宝TDDL(TAOBAO DISTRIBUTE DATA LAYER)
剖析淘宝TDDL(TAOBAO DISTRIBUTE DATA LAYER) 博客分类: 原博客地址: http://qq85609655.iteye.com/blog/2035176 distrib ...