gcc extension in get_user_pages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi.  In get_user_pages there is a C conditional operator with an
omitted second operand:


  if ( !vma || (pages && vma->vm_flags & VM_IO) || !(flags & vma->vm_flags) )
        return i ? : -EFAULT;

I was unfamiliar with that syntax, couldn't find it in the C99
standard, and finally found it in the gcc documentation, which says
that
   x ? : y 
.. is the same as 
   x ? x : y 

But it also says the extension is only useful when the first operand
may contain a side effect.  In get_user_pages, i is a simple integer,
and so the extension is just a confusing shorthand.  Is that right or
is there some better reason than being one character shorter -- like
maybe better asm gets produced when the extension is used?

-- 
--Ed L Cashin            |   PGP public key:
  ecashin@uga.edu        |   http://noserose.net/e/pgp/

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux