官方说明

看看cflags中 fsigned-char的说明:

-fsigned-char — Allows the type char in the native libraries to be signed, like signed char. Each kind of machine has a default for what char should be. It is either like unsigned charby default or like signed char by default. By default on Android NDK char type is unsigned, but char is treated as signed on x86. This is an option imposed by Superpowered SDK authors, so we’ll include this as well.

默认android ndk中char类型是unsigned,在x86上是signed类型。。

ndk中,对于负数来说,char val = -3,printf出的值是253,而不是-3。。差距这么大的值,在项目中会有意外的表现。。

 

不想该代码的话,可以使用下面的设置,进行修改:

LOCAL_CFLAGS := -fsigned-char

出自网站:https://expertise.jetruby.com/android-ndk-using-c-c-native-libraries-to-write-android-apps-21550cdd86a

 

申明

  • http://blog.csdn.net/ryfdizuo/

 

 

更多相关文章

  1. Unity3D Vuforia Android(安卓)拨打电话
  2. [置顶] android AIDL 进程间通信
  3. android中build.gradle文件简单说明
  4. Android权限列表permission说明 [轉載]
  5. Android(安卓)各种类型的资源 文件
  6. View类的XML属性、相关方法及说明
  7. Android(安卓)-- 再来一发Intent
  8. Android文件关联
  9. Android(安卓)Studio生成APK自动追加版本号

随机推荐

  1. ScreenUnLock-图形解锁控件使用详解
  2. 基于MVC4+EasyUI开发附件上传组件uploadi
  3. 搭建Visual Stduio 2010开发环境的图文详
  4. 实例分析ASP.NET在MVC5中使用MiniProfile
  5. C#如何计算传入的时间距离今天的时间差的
  6. asp.net页脚制作详解
  7. ASP.NET教程--MVC中SignalR的基础讲解
  8. Asp.net MVC中关于Razor问题的解决方法
  9. 分别介绍MVC、MVP和MVVM是什么
  10. C#中序列化的使用总结