zoukankan      html  css  js  c++  java
  • 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.

    //如果不是浮点数精度

      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类型。
  • 相关阅读:
    C 语言 静态库和动态库的创建和应用
    C++ 中英文术语对照
    下午
    [转]内核 do_fork 函数源代码浅析
    关于C#反射机制,自己写的
    获取字符串中数字
    关于C#反射机制,来源于网络
    关于 Nhinernate 的one to one(转载)
    鼠标坐标的记录
    关于C#中hibernate.cfg.xml动态加载问题
  • 原文地址:https://www.cnblogs.com/xuaidongstdudyrecording/p/7067118.html
Copyright © 2011-2022 走看看