In the 3.0.4 Linux kernel, mm/filemap.c has this line of code:
retval = retval ?: desc.error;
I've tried compiling a similar minimal test case with gcc -Wall and don't get any warnings; the behavior seems identical to:
retval = retval ? retval : desc.error;
Looking at the C99 standard, I can't figure out what formally describes this behavior. Why is this OK?
question from:https://stackoverflow.com/questions/7814694/bizarre-use-of-conditional-operator-in-linux