inliner warnings with Map literal and -optimize

scala在编译&优化的时候,有时候会返回个inline warning.但是,实际上我们写代码已经不能再优化了. 比如如下这个例子:

yu:~ yu$ scala -version
Scala code runner version 2.11.7 -- Copyright 2002-2013, LAMP/EPFL
yu:~ yu$ scala -optimize -Yinline-warnings
Welcome to Scala version 2.11.7 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_05).
Type in expressions to have them evaluated.
Type :help for more information.

scala> object O { Map(
     |   "a" -> 0, "b" -> 1, "c" -> 2, "d" -> 3, "e" -> 4,
     |   "a" -> 0, "b" -> 1, "c" -> 2, "d" -> 3, "e" -> 4,
     |   "a" -> 0, "b" -> 1, "c" -> 2, "d" -> 3, "e" -> 4,
     |   "f" -> 5, "g" -> 6, "h" -> 7, "i" -> 8) }
warning: At the end of the day, could not inline @inline-marked method ->$extension
warning: At the end of the day, could not inline @inline-marked method ->$extension
warning: At the end of the day, could not inline @inline-marked method ->$extension
warning: At the end of the day, could not inline @inline-marked method ->$extension
defined object O

我们可以看到有个issue ,讲的就是这件事.它是12年底建立的,但一直没啥好的回答...可怜我为了关掉这个warning连带好几个其它warning都不能用了.

不过,今年五月终于有结果了.

(more…)

mysql添加自增索引后一个报错解

现在有一个mysql数据库表,需要给主键加上自增。很容易可以找到命令类似于下面这样

alter table `table_name` 
change column `id` 
`id` int(10) unsigned auto_increment not null ;

但是,一直没问题的代码这次失效了,报错如下:

ERROR 1062: ALTER TABLE causes auto_increment resequencing, 
resulting in duplicate entry '1' for key 'PRIMARY'

(more…)

mozjs185 在哪里?

安装某个东西,cmake的时候,报错如下

-- checking for module 'mozjs185'
--   package 'mozjs185' not found

如往常,copy这个module的名字,然后

# yum search mozjs185

结果是Not Found (废话,如果不是not found,还写这个干啥...) 直接杀到网上找结果。 (more…)

fix记录:注意返回值

sqlite3使用sqlite3_exec,原型如下:

int sqlite3_exec(
    sqlite3*,                                  /* An open database */
    const char *sql,                           /* SQL to be evaluated */
    int (*callback)(void*,int,char**,char**),  /* Callback function */
    void *,                                    /* 1st argument to callback */
    char **errmsg                              /* Error msg written here */
);

其中有个参数是callback类型的。查询到的数据放在callback中处理。 (more…)

error: file ‘/boot/grub2/locale/en.mo.gz’ not found

从fedora 17或者更早的时候开始,启动grub2,系统会弹出一行错误提示,然而在你迅雷不及掩耳盗铃之时,grub已经弹到了menu,直到某一天,区区利用虚拟机的暂停功能,终于看到了那行错误提示,上曰:

error: file '/boot/grub2/locale/en.mo.gz' not found

Redhat其实早就看到这错误了,Bug report一大坨,可惜到目前,fedora 18了都,还是要手工改。 (more…)

implicit declaration of function ‘xxx’

随手几行测试代码,编译居然报了一排warning,仔细查看,都是类似如下格式的:

xxx\xx.c||In function 'xxx':|
xxx\xx.c|14|warning: implicit declaration of function 'memset' [-Wimplicit-function-declaration]|
xxx\xx.c|14|warning: incompatible implicit declaration of built-in function 'memset' [enabled by default]|

(more…)

C语言写宏注意事项,一次debug的教训

现在有代码如下.

宏定义设置好:

#define ERROR_RET(x) error_code=x;return false;

然后期望在以后某处调用如下:

void fun()
{
    if(sth) ERROR_RET(eno);
    ....
}

编译护结果始终不理想.逻辑和想的不一样啊...查了别的代码好久,一直以为其它地方数据处理有问题. (more…)