错误1:
编译时出现这个错误,呆了很久,后来定睛一看,原来,函数指针赋值出错。比较离谱,居然在赋值时加上括号,fs_ls() 。记录一下。
int fs_ls(); int fs_cd(); struct command buildin_cmd[]={ { "ls" , fs_ls } , { "cd" , fs_cd } }; |
比较运算符的优先级大于位运算。还是要多打括号啊。
if ( (flag & IN_USE) == 0 ){ do_something(); } |
错误3:
不能提领指针,原因结构体成员要一起声明。
extern struct tty_line { int row ; int colum ; } tty_struct [TTY_NUM ] ; struct tty_line *tp = &tty_struct[0] ; tp->row = 0 ; tp->colum = 0 ; |