问题描述:

case get(?Player_LoopTaskInfo) of
{TargetCnt, TaskStar, TaskExp} ->
ok;
_ ->
throw("not_found_loop_task_info")
end
在case语句中,这样写,编译时,会提示变量unsafe,解决编译器报错的方法有下面两个:
1、给unsafe的变量赋值
case get(?Player_LoopTaskInfo) of
{TargetCnt, TaskStar, TaskExp} ->
ok;
_ ->
TargetCnt=0,TaskStar=0,TaskExp=0,
throw("not_found_loop_task_info")
end

2、把case语句拆成函数

{TargetCnt, TaskStar, TaskExp} = valid_task_info(get(?Player_LoopTaskInfo))
valid_task_info({_, _, _} = Info) -> Info;
valid_task_info(_) -> throw("not_found_loop_task_info").

variable 'xxx' unsafe in 'case'的处理的更多相关文章

  1. local variable 'xxx' referenced before assignment

    这个问题很囧,在外面定义了一个变量 xxx ,然后在python的一个函数或类里面引用这个变量,并改变它的值,结果报错local variable 'xxx' referenced before as ...

  2. 【转】The final local variable xxx cannot be assigned, since it is defined in an enclosing type

    文地址:http://blog.163.com/benben_long/blog/static/199458243201481102257544/ 本文就自己编程时候遇到的一个问题,简要描述一下,并提 ...

  3. 错误:variable `xxx' has initializer but incomplete type

    错误:variable `xxx' has initializer but incomplete type 原因:xxx对应的类型没有找到,只把xxx声明了但是没给出定义.编译器无从确认你调用的构造函 ...

  4. VS2008中Run-Time Check Failure #2 - Stack around the variable 'xxx' was corrupted 错误解决方法

    问题 : 在用VS2008写一段代码,算法都没有问题,但是调试的时候发现出了main之后就报 Stack around the variable 'xxx' was corrupted 的错误,后来发 ...

  5. Python问题:UnboundLocalError: local variable 'xxx' referenced before assignment

    参考链接: http://blog.csdn.net/onlyanyz/article/details/45009697 https://www.cnblogs.com/fendou-999/p/38 ...

  6. variable `xxx' has initializer but incomplete type

    错误:variable `xxx' has initializer but incomplete type 原因:xxx对应的类型没有找到,只把xxx声明了但是没给出定义.编译器无从确认你调用的构造函 ...

  7. python: local variable 'xxx' referenced before assignment

    问题发现 xxx = 23 def PrintFileName(strFileName): if xxx == 23: print strFileName xxx = 24 PrintFileName ...

  8. local variable 'xxx' referenced before assignment(犯过同样的错)

    这个问题很囧,在外面定义了一个变量 xxx ,然后在Python的一个函数里面引用这个变量,并改变它的值,结果报错local variable 'xxx' referenced before assi ...

  9. vs中 Stack around the variable 'XXX' was corrupted.

    https://blog.csdn.net/hou09tian/article/details/75042206 把 project->配置属性->c/c++->代码生成->基 ...

随机推荐

  1. MX4连接后adb无法识别解决方法

    1. 使用android SDK目录中的 android SDK目录\tools 下的android脚本,命令行中执行 android update adb,成功运行后,会在用户名录下产生,C:\Us ...

  2. OC中的内存问题

    常见的内存问题有以下几种: 1.野指针异常:访问没有所有权的内存,如果想要安全的访问,必须确保空间还在 2.内存泄露:空间使用完之后没有及时释放 3.过度释放:对同一块存储空间释放多次,立刻crash ...

  3. Swift的7大误区

    Swift正在完成一个惊人的壮举,它正在改变我们在苹果设备上编程的方式,引入了很多现代范例,例如:函数式编程和相比于OC这种纯面向对象语言更丰富的类型检查. Swift语言希望通过采用安全的编程模式去 ...

  4. HTTP 协议的头部

    转自:http://network.51cto.com/art/201509/490594.htm HTTP首部字段有四种类型:通用首部字段,请求首部字段,响应首部字段,实体首部字段. 通用首部字段: ...

  5. linux移植问题汇总(一)

    linux移植问题汇总(一) 在此记录移植linux过程中出现的问题以及解决方法. 项目GitHub地址 linux3.0.80:https://github.com/numbqq/linux-3.0 ...

  6. D_S 顺序栈的基本操作

    //  main.cpp #include <iostream> using namespace std; #include "Status.h" typedef in ...

  7. Linux学习之七——乱码的解决方案

    一.乱码的原因 乱码是编码不统一引起的,有下面一些地方需要注意 1. Linux 系统默认支持的语系数据:这与 /etc/sysconfig/i18n 有关:2. 你的终端界面 (bash) 的语系: ...

  8. Tomcat 内存和线程配置优化

    1. tomcat 的线程配置参数详情如下: 修改conf/server.xml中的<Connector .../> 节点如下: <Connector port="8080 ...

  9. c++ initialize_list

    看到这么一个东西,可以实现花括号( "{" "}" )初始化容器类. 使用时需包含头文件 #include <initialize_list> 我们 ...

  10. 实验:sigsuspend(),sigprocmask()

    实验:sigsuspend(),sigprocmask() 源代码: /* * Program: pause_suspend.c * To test the difference between si ...