Re: EXT2FS Problems -- Interesting Code Snippet
Brent Fulgham <email@example.com> writes:
> One other thing that is probably not a problem, but
> caught my eye, is the way the conditional operator
> is used here:
> + ? (sblock->s_prealloc_blocks ?: EXT2_DEFAULT_PREALLOC_BLOCKS)
> Will this construct (?:) result in the conditional passing
> a NULL to the ext2_new_block method? On IBM's compiler
> for AIX this won't even compile.
This construct is a GNU C extension. a ?: b is equivalent to a ? a : b,
except that a is evaluated only once.
I.e. ?: behaves the way || would have behaved if C did the Right Thing ;)
Compare with lisp's (or a b) .