warning: this decimal constant is unsigned only in ISO C90问题的处理及理解
参考:https://blog.csdn.net/duguduchong/article/details/7709482
https://bbs.csdn.net/topics/391892978?page=1
问题描述:直接输出一个大整数常量时会出现改警告。如下:
#include <iostream>
#include <stdlib.h> int main() {
printf("%d\n",); //int型取值范围 -2147483648~2147483647
return ;
}
原因:数字超出默认类型int型的表示范围。
在gcc中缺省使用C90标准编译,编译器将按C90标准将你的-2147483648转成无符号的十进制(但不影响你的结果)。
解决方法:1:不用管。
2:在该数字后加u(大小写无关),变为无符号整型(0~4294967295)。
3:在gcc的编译选项中加 --std=c99。
4:使用十六进制的数字,如0xFFFFFFFF
warning: this decimal constant is unsigned only in ISO C90问题的处理及理解的更多相关文章
- Write a program to convert decimal to 32-bit unsigned binary.
Write a program to convert decimal to 32-bit unsigned binary. Write a program to convert a 32-bit un ...
- warning:ISO C90 forbids mixed declarations and code
warning:ISO C90 forbids mixed declarations and code 变量定义之前不论什么一条非变量定义的语句(重视:语句是会带分号的)都会引起这个警告! 将非变量的 ...
- warning C4305: “=”: 从“int”到“unsigned char”截断解决方法[zz]
在控制台程序中定义: float x; x=22.333; 编译会出现 warning C4305: “初始化”: 从“double”到“float”截断 系统默认此浮点数是22.333是double ...
- warning: already initialized constant FileUtils::VERSION
Ran into this, and the solution here works: https://stackoverflow.com/questions/51334732/rails-5-2-0 ...
- 《c陷阱与缺陷》笔记--注意边界值
如果要自己实现一个获取绝对值的函数,应该都没有问题,我这边也自己写了一个: void myabs(int i){ if(i>=0){ printf("%d\n",i); }e ...
- 51Nod 1344 走格子
参考自:https://www.cnblogs.com/ECJTUACM-873284962/p/6445381.html 1344 走格子 基准时间限制:1 秒 空间限制:131072 KB 分值: ...
- POJ3013 Big Christmas Tree
题目:http://poj.org/problem?id=3013 求每个点到1的最短路.不是最小生成树. 总是WA.看讨论里说INF至少2e10,于是真的A了! 算一下,dis最大可能3276800 ...
- LeedCode OJ -- String to Integer (atoi)
点击打开题目链接 题目意思就是自己实现一个atoi函数,也就是将字符串转换成int型. 关于INT_MAX和INT_MIN, 只是在<limits.h>文件中定义的宏..分别是int型可以 ...
- 【C++】为什么INT_MIN不是直接写成-2147483648(转载)
最近在编程中遇到一个问题: #include <iostream> using namespace std; int main() { int n = -2147483648; //cou ...
随机推荐
- 微信小程序开发——开发者工具中素材管理功能使用的注意事项
为什么使用“素材管理”: 微信小程序环境中本地资源图片是无法通过 WXSS 获取的,可以使用网络图片,或者 base64,或者使用<image/>标签.. 当然,如果不想这么麻烦,你可能会 ...
- 【python】理解循环:for,while
先看下for结构: #!/usr/bin/python # -*- Coding:UTF-8 -*- for i in range(1): print i 输出: 0 输入和输出: #!/usr/bi ...
- Django的视图函数和路由系统中一些没有用过的小点
1.request对象 print("返回用户访问的url,但是不包括域名",request.path_info) print("返回请求的方法,全大写",re ...
- ABAP中不修改内表参照的结构,给内表/结构体增加字段
Situation: DATA: itab TYPE STANDARD TABLE OF zsrsodtla_stru1, wa_itab TYPE zsrsodtla_str ...
- php libev扩展使用
在WorkerMan源码分析 - 实现最简单的原型文章中提到了libevent网络库,前者和libev都是事件驱动编程库高性能.简单说libev对libevent做了改进和精简.libevent使用全 ...
- eclipse 安装python后pydev不出现
一.环境 windows 7 64bit eclipse 4.5.2 pydev jdk7u55 二.安装步骤 1. 安装JDK eclipse依赖于java环境,所以需要安装java运行环境JRE. ...
- go语言中的函数
package main; import "fmt" func main() { a, b, c := A(1, 2, 3); fmt.Println(a, b, c); //调用 ...
- System.ServiceProcess.TimeoutException: Time out has expired and the operation has not been completed.
项目代码如下 ServiceController service = new ServiceController("ModbusAgent"); service.Stop(); T ...
- input 原生上传文件(type = file)
1.表单上传文件的步骤: - 1)设置enctype 默认为:enctype="application/x-www-form-urlencoded"(一般不设置) 若要表单中有需要 ...
- Python 官方文件
7.2. 文件读写 函数 open() 返回 文件对象,通常的用法需要两个参数:open(filename, mode). >>> f = open('workfile', 'w') ...