在控制台程序中定义:

float x;

x=22.333;

编译会出现 warning C4305: “初始化”: 从“double”到“float”截断

系统默认此浮点数是22.333是double型,对float型变量赋值,所以会出现警告。

解决:

1、就将其后面加上f,如2.3f,就告诉系统这是浮点数。

2、由于float是6位有效数字,double是15位。如果有精度要求高的,就将其定义为double,但是占内存从4字节增加到8字节。

zz来源:http://blog.csdn.net/cgcoder/article/details/7367965【shenlan282博客】

warning C4305: “=”: 从“int”到“unsigned char”截断解决方法[zz]的更多相关文章

  1. warning C4305:“初始化”:从“double”到“float”截断

    编译VS项目时出现警告: warning C4305:“初始化”:从“double”到“float”截断(warning C4305: 'initializing' : truncation from ...

  2. error C2220: warning treated as error - no 'object' file generated解决方法

    error C2220: warning treated as error - no 'object' file generated 警讯视为错误 - 生成的对象文件 / WX告诉编译器将所有警告视为 ...

  3. warning: a non-numeric value encountered in line *的解决方法

    今天ytkah在调试项目的时候出现了一个警告warning: a non-numeric value encountered in line 694,查看php官方文档,上面解释说在使用(+ - * ...

  4. for遍历用例数据时,报错:TypeError: list indices must be integers, not dict,'int' object is not iterable解决方法

    一:报错:TypeError: list indices must be integers, not dict for i in range(0,len(test_data)): suite.addT ...

  5. Xhprof graphviz Warning: proc_open() [function.proc-open]: CreateProcess failed, error code 解决方法

    Xhprof在windows下点击[View Full Callgraph]调用graphviz软件时.警告Warning: proc_open() [function.proc-open]: Cre ...

  6. git出现warning: LF will be replaced by CRLF的解决方法

    今天ytkah用git上传文件的时候出现了warning: LF will be replaced by CRLF的错误,具体信息如下,这是因为跨平台开发下产生的.由于编辑器的不同或者Windows程 ...

  7. Integral Promotions整数提升和符号扩展(char,unsigned char,signed char)

    以下来自msdn: Objects of an integral type can be converted to another wider integral type (that is, a ty ...

  8. Calling a C++ dll with unsigned char* parameters

    unsigned char*  等价 BYTE* 例1: C++: int __stdcall LIVESCAN_GetFPRawData(int nChannel, unsigned char *p ...

  9. C/C++中unsigned char和char的区别

    代码: #include <cstdio> #include <iostream> using namespace std; int main(){ unsigned char ...

随机推荐

  1. Dynamics AX 2012 R2 安装额外的AOS

    众所周知,AX系统分为三层:Client,Application Server,Database Server. 我们添加额外的Application Server主要是出于以下两个原因: 使用多台服 ...

  2. css3实现轮播

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  3. mac攻略(一) -- git使用

    1.首先在官网下载 https://git-scm.com/download/mac   2.然后安装git(mac自带git)   3设置Git的user name和email:   $ git c ...

  4. bootstrap-table 加载不了数据问题总结

    1.Without server-side pagination data-side-pagination="client"(bs-table的设置) 服务器端代码: @Reque ...

  5. printf("%*s%s%*s",——)是什么?

    我们可能知道scanf里用*修饰符,是起到过滤读入的作用.比如一个有三列数值的数据,我只想得到第2列数值,可以在循环里用scanf(“%*d%d%*d”, a[i])来读入第i行的第2个数值到a[i] ...

  6. 利用backtrace和objdump进行分析挂掉的程序

    转自:http://blog.csdn.net/hanchaoman/article/details/5583457 汇编不懂,先把方法记下来. glibc为我们提供了此类能够dump栈内容的函数簇, ...

  7. Install Google Pinyin on Ubuntu 14.04

    Install Google Pinyin on Ubuntu 14.04 I've been spending more and more time on Ubuntu and I'm not us ...

  8. iOS 如何适配iOS10

    转自: http://www.cnblogs.com/jukaiit/p/5881062.html 2016年9月7日,苹果发布iOS 10.2016年9月14日,全新的操作系统iOS 10将正式上线 ...

  9. Ubuntu anzhuang

    zhongwenshurubuzhidaozenmeqiehuan anhzuang Flash  apt-get install flashplugin-installer

  10. 用spring的InitializingBean作初始化

    org.springframework.beans.factory包下有一个接口是InitializingBean 只有一个方法: /**  * Invoked by a BeanFactory af ...