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 ...
随机推荐
- ifconfig命令详情
基础命令学习目录首页 原文链接:https://blog.csdn.net/weixin_37886382/article/details/79716879 许多windows非常熟悉ipconfig ...
- Scrum Meeting 5 -2014.11.11
放假过掉一大半.大家都努力赶着进度,算法实现基本完成.可能还有些细小的改动,但也可以统一进入测试阶段了. 今天叫了部分在校人员开了个小会.任务决定以测试为主,同时开始进行服务器的部署. 在之前尝试服务 ...
- spring冲刺第六天
昨天编写地图代码,完善地图界面,使其变得美观. 今天把地图界面初步完成,和其他团队成员的成果进行结合,整合人物和地图代码. 遇到的问题:在整合时遇到的问题比较多,今天没有整合成功.
- Task 3 求最大数组和
题目:返回一个整数数组中最大子数组的和. (要求:输入一个整形数组,数组里有正数也有负数. 数组中连续的一个或多个整数组成一个子数组,每个子数组都有一个和. 求所有子数组的和的最大值.要求时间复杂度为 ...
- 猫咪记单词——NABCD模型分析
N ——Need 需求:学习英语是一件非常重要的事.面对各种各样的考试,学习英语,最重要的就是词汇量,背单词是提高词汇量的最直接的方法,但是单纯的背单词太单调.寻找一些合适的,更易于接受的背单词学习英 ...
- 第三个spirit(第十四天)
一 .进度(自习室) 本来十号要开始进行第三次冲刺,不过因为团队很多成员要进行协会和组织的换届,而且团队还换了新 人又加了人进来,所以我们今天才是第三次冲刺的第一天.我们进行了新团队的第一次会议.基于 ...
- diliucizuoye
NABCD N(Need 需求) 互联网的高速发展,造就了二十一世纪这个追求高品质.高体验的信息时代,随其发展改变的是信息记录与分享方式,从传统的面对面交流.手机通话.写日记本,到现如今的社交平台.信 ...
- Mac下不能安装第三方下载软件
1.安装成功后,启动时如提示“某某文件已损坏,打不开”,请将电脑的“系统偏好设置--安全性与隐私--通用”的允许从以下位置下载的应用程序设置为“任何来源”. 2.如果您的电脑上没有“任何来源”的选项, ...
- iOS开发值得收藏的博客
http://kobedai.me/ objc.io PS:经典,内容深而广objc中国NSHipster PS:很多小细节NSHipster 中文版唐巧的技术博客 PS:LZ是唐巧的脑残粉…OneV ...
- Internet History, Technology and Security (Week 3)
Week 3 History: The Web Makes it Easy to Use Welcome to week 3! This is our fourth and final week of ...