博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
c/c++基本数据类型转换
阅读量:6945 次
发布时间:2019-06-27

本文共 1434 字,大约阅读时间需要 4 分钟。

 

    • 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.

 

//如果不是浮点数精度

 

 

    1. 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类型。

转载于:https://www.cnblogs.com/xuaidongstdudyrecording/p/7067118.html

你可能感兴趣的文章
如何设计定向爬虫
查看>>
初识toolstack——XEN的XenServer管理的核心
查看>>
20篇教你得到酷炫效果的JQuery教程
查看>>
安装程序找不到Office.zh-cn\OfficeMUI问题
查看>>
如何使用VIM的列编辑模式 [转]
查看>>
System.Collections简介
查看>>
POJ-3211 Washing Clothes[01背包问题]
查看>>
Android--MediaPlayer(实现列表选歌,上一首,下一首,清空播放列表,搜索本地音乐文件)...
查看>>
ODE的buggy例程分析
查看>>
判断文章/帖子操作权限
查看>>
计算机英文缩写
查看>>
Windows2003 SQL2005解决系统Administrator密码不知道的问题
查看>>
curl常用的5个例子(转)
查看>>
wCF 问题收集页
查看>>
《ASP.NET MVC4 WEB编程》学习笔记------.net mvc实现原理ActionResult/View
查看>>
1、传感器概述
查看>>
需求分析报告和需求规格说明书有什么区别
查看>>
转:Vmware Exsi使用简要说明
查看>>
MessageDigest简单介绍
查看>>
Apache commons-net用法的一个示例
查看>>