问题描述:

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. Android 手机号码格式验证

    package com.app.android01 ; import android.app.Activity; import android.os.Bundle; import android.te ...

  2. android XMl 解析神奇xstream 四: 将复杂的xml文件解析为对象

    前言:对xstream不理解的请看: android XMl 解析神奇xstream 一: 解析android项目中 asset 文件夹 下的 aa.xml 文件 android XMl 解析神奇xs ...

  3. 基础学习day01--JAVA入门和JDK的安装与配置

    一.软件是什么 软件按照一定顺序组成的计算机指令和数据集合. 二.什么是软件开发 软件开发是使用计算机的语言制作的软件.如迅雷,Windows系统,Linux,QQ等. 三.DOS常用命令 cd..: ...

  4. IOS组件绑定无效错误

    报错的原因:界面按钮事件没有绑定到源代码或者相关的代码被注释了.比如你的button组件以及绑定到IBOutlet,但是viewcontrol.m上没有相关的代码,就会出现异常.

  5. javascript中的 类初始化,遍历for in 以及with的用法

    <script type="text/javascript"> function member(name,gender){ this.name=name; this.g ...

  6. Volley源码分析(2)----ImageLoader

    一:imageLoader 先来看看如何使用imageloader: public void showImg(View view){ ImageView imageView = (ImageView) ...

  7. 异常处理——毕向东Java基础教程学习笔记

    1.异常:就是程序运行过程中出现的不正常情况. 异常的由来:问题本身也是日常生活中一个具体的事物,也可以通过java类的形式进行描述,并封装成对象.                        其实 ...

  8. 关于EditText的一点深入的了解

    最近在开发android下的记事本程序时,频繁的使用EditText控件,折腾来折腾去,算是对其的了解更深入了一些.特将这些收获记录如下: 一.几个属性的介绍 android:gravity=&quo ...

  9. 烂泥:KVM安装Windows Server 2008 R2使用virtio硬盘

    本文首发于烂泥行天下. 在上一篇文章中,我们介绍了使用IDE硬盘来安装Windows Server 2008 R2,这篇文章我们来介绍使用virtio硬盘来安装Windows Server 2008 ...

  10. matlab2015b调用摄像头

    参考链接:http://blog.csdn.net/lyqmath/article/details/7307429 本人电脑是宏碁T5000 调用代码: % By lyqmathclc; clear ...