问题描述:

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. ubuntu下安装程序的三种方法

    引言 在ubuntu当中,安装应用程序我所知道的有三种方法,分别是apt-get,dpkg安装deb和make install安装源码包三种.下面针对每一种方法各举例来说明. apt-get方法 使用 ...

  2. 转:Android 判断用户2G/3G/4G移动数据网络

    Android 判断用户2G/3G/4G移动数据网络 在做 Android App 的时候,为了给用户省流量,为了不激起用户的愤怒,为了更好的用户体验,是需要根据用户当前网络情况来做一些调整的,也可以 ...

  3. MacBook Air 使用技巧

    1.Finder             相当于资源管理器 Launchpad       相当于桌面 Safari              浏览器 2.快捷键 * cmd+shift+3: 捕获整 ...

  4. C中的一些经常会用到的函数

    1.sscanf 函数原型: int sscanf(const char *,const char *,...); int sscanf(const char *buffer,const char * ...

  5. KVC实现原理简介

    KVC,全称:Key-Value-Coding. KVC运用了isa-swizzling技术.isa-swizzling就是类型混合指针机制.KVC主要通过isa-swizzling来实现其内部定位查 ...

  6. 【读书笔记】iOS-UIWindow-密码框

    一,工程结构,如下图所示: 二,代码 PasswordInputWindow.h #import <UIKit/UIKit.h> @interface PasswordInputWindo ...

  7. 利用PPT的WebBroswer控件助力系统汇报演示

    如何在PPT演示过程中无缝衔接演示系统成果?使用PPT自带的WebBroswer控件即可,相当于在PPT里嵌入了浏览器,在这个浏览器里打开系统进行操作演示. 环境:Windows 7 + Office ...

  8. 【Adaboost算法】C++转C, 分类器结构设计

    一.参考OpenCV的CascadeClassifier类LBPEvaluator类 如下,筛选出存放分类器相关信息的成员变量: class CV_EXPORTS_W CascadeClassifie ...

  9. TreeSize工具介绍

    TreeSize Professional 工具是一个功能强大且灵活方便的硬盘空间管理工具,能在 Windows 8/7/Vista/XP 或 Windows Server 2012年/2008年/2 ...

  10. SpringMVC中@ResourceMapping的基本用法

    最近从Struts转投SpringMVC,看代码时发现这个注解,感觉其作用应该和Struts的action差不多,把用法记录下来. 1. @RequestMapping(value="/de ...