"warning: suggest parentheses around assignment used as truth value"

Add comments

ふつうのLinuxプログラミング Linuxの仕組みから学べるgccプログラミングの王道

ふつうのLinuxプログラミング Linuxの仕組みから学べるgccプログラミングの王道』の198ページのコードで出た警告。gccには”-Wall”オプションを付けてます。以前にも遭遇した警告なのに忘れていたので、メモしておこう。

while (ent = readdir(d)) {

while ((ent = readdir(d))) {

に修正。

while ((ent = readdir(d)) != NULL) {

でも同じ?

Comments are closed.

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS ログイン