代码:

#import<Foundation/Foundation.h>
int main(int argc,const char * argv[]){
        const char *words[4]={"mother","father","sister","ms"};
        int wordCount=4;
        int i;
        for(i=0;i<wordCount;i++){
             NSLog(@"%s is %d characters                          long",words[i],strlen(words[i]));
         }
         return (0);
}

解决:
把%d改为%zu就没有警告了

分析:

%d是输出数字整数,警告里面的size_t是unsigned int

size_t 和int的区别是
size_t是一些C/C++标准在stddef.h中定义的。这个类型足以用来表示对象的大小。
size_t的真实类型与操作系统有关,在32位架构中被普遍定义为:
typedef unsigned int size_t;

而在63位架构中被定义为:
typedef unsigned long size_t;
size_t在32位架构上是4字节,在64位架构上是8字节,在不同架构上进行编译时需要注意这个问题
int在不同架构下都是4字节
int是带符号书,size_t是无符号数

警告Conversion specifies type'int' but the argument has type'size_t'的更多相关文章

  1. Format specifies type 'int' but the argument has type 'struct node *'

    /Users/Rubert/IOS/iworkspace/LineList/LineList/main.c::: Format specifies type 'int' but the argumen ...

  2. Ubuntu gcc编译报错:format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 2 has type ‘__time_t’ [-Wformat=]

    平时用的都是Centos系统,今天偶然在Ubuntu下编译了一次代码,发现报错了: 源码: #include <stdio.h> #include <sys/time.h> # ...

  3. TypeError: Fetch argument 0 has invalid type <type 'int'>, must be a string or Tensor. (Can not convert a int into a Tensor or Operation.)

    6月5日的時候,修改dilated_seg.py(使用tensorflow)出現了報錯: TypeError: Fetch argument 0 has invalid type <type ' ...

  4. Implicit conversion from enumeration type 'enum CGImageAlphaInfo' to different enumeration type 'CGB

    Implicit conversion from enumeration type 'enum CGImageAlphaInfo' to different enumeration type 'CGB ...

  5. The method setPositiveButton(int, DialogInterface.OnClickListener) in the type AlertDialog.Builder is not applicable for the arguments

    The method setPositiveButton(int, DialogInterface.OnClickListener) in the type AlertDialog.Builder i ...

  6. Cannot convert value of type [java.lang.String] to required type [java.util.Date] for property 'xxx': no matching editors or conversion strategy found

    今天在完成项目的时候遇到了下面的异常信息: 04-Aug-2014 15:49:27.894 SEVERE [http-apr-8080-exec-5] org.apache.catalina.cor ...

  7. block中出现此种报错: Incompatible block pointer types initializing 'float (^__strong)(float, float)' with an expression of type 'int (^)(float, float)'

    当block(代码块)的返回值是float时,应注意的地方:定义的返回值类型一定要与return的返回值类型一样 我们以两个数的四则运算来举例 在main.m文件中的四则运算中,我采用两种返回值类型( ...

  8. The method replace(int, Fragment, String) in the type FragmentTransaction is not applicable for the arguments (int, SettingFragment, String)

    The method replace(int, Fragment, String) in the type FragmentTransaction is not applicable for the ...

  9. delete attempted to return null from a method with a primitive return type (int)

    今天被自己给蠢死了 今天在代码中遇到这个错误, 百度翻译一下:映射方法,从一org.system.mapper.child.chmorganizationexaminationmapper.delet ...

随机推荐

  1. HA集群基本概念详解

    一.高可用集群的定义 二.高可用集群的衡量标准 三.高可用集群的层次结构 四.高可用集群的分类 五.高可用集群常用软件 六.共享存储 七.集群文件系统与集群LVM 八.高可用集群的工作原理 一.高可用 ...

  2. 1102 Invert a Binary Tree (25 分)(二叉树遍历)

    二叉树有N个结点,给出每个结点的左右孩子结点的编号,把二叉树反转(左右孩子交换  所以是后序遍历交换) 输出反转后二叉树的层序遍历和中序遍历 #include<bits/stdc++.h> ...

  3. Android的WebView有哪些坑?

    今天逛知乎的时候,看到一个有关Android应用开发中,WebView 的问题,算是开发中比较常见的问题了吧,而且赞同数比较多的答案,确实回答得还不错,这里小编就整理了一下,分享出来大家借鉴借鉴,避免 ...

  4. Crash的游戏 [组合+递推]

    题面 思路 问题转化 这个问题的核心在于,我们需要把"加入一个球.拿出一个球"这两个操作转化一下 因为显然两个操作同时进行的话,我们没有办法从单纯的组合意义去分析 我们首先把$m$ ...

  5. [bzoj] 3224 Tyvj 1728 普通平衡树 || 平衡树板子题

    #include<cstdio> #define N 100010 #define which(x) (ls[f[(x)]]==(x)) using namespace std; int ...

  6. 【POJ 3080 Blue Jeans】

    Time Limit: 1000MSMemory Limit: 65536K Total Submissions: 19026Accepted: 8466 Description The Genogr ...

  7. Codeforces Round #352 (Div. 2) A

    A. Summer Camp time limit per test 1 second memory limit per test 256 megabytes input standard input ...

  8. hashCode()方法和equals方法的重要性。

    在Object中有两个重要的方法:hashCode()和equals(Object obj)方法,并且当你按ctrl+alt+s时会有Generator hashCode()和equals().我们不 ...

  9. sublime text 3将px换算为rem的插件的安装及使用

    标签: rem这个单位对于移动端来说是比较强大的,所以这里给大家介绍sublime text 3将px换算为rem的插件的安装及使用,只要安装了这个插件,输入多少px,sublime就会提示相应的re ...

  10. 微信设置URL之WebApi方式

    微信公众号开发者设置里的URL,现在采用WebAPI的方式,结果一直报“未能正确设置Token”的错误,采用Handler和MVC的方式倒是可以. 解决步骤一,添加服务器IP到白名单. 解决步骤二,确 ...