> I found a !! in glusterfs sources. Is it a C syntax I do not know, a
> bug, or just a weird syntax?
> 
> xlators/cluster/afr/src/afr-inode-write.c:
>      local->stable_write = !!((fd->flags|flags)&(O_SYNC|O_DSYNC));

It's a common idiom in the Linux kernel/coreutils community.  I
thought it was in BSD too.  It's a convenient way to coerce any
arbitrary non-zero integer value into a specific value of one,
for code that uses integers as booleans.  I wouldn't assume it's
a bug, since that seems to be precisely what's called for in the
snippet you provided, but I guess that means it's weird syntax.
_______________________________________________
Gluster-devel mailing list
[email protected]
http://www.gluster.org/mailman/listinfo/gluster-devel

Reply via email to