Am Monday 14 May 2012 schrieb Giuseppe Scrivano: > > flags = fcntl (fd, F_GETFL, 0); > > if (flags < 0) > > > > - return flags; > > + return -1; > > I think that if the caller doesn't really care about the result but just > check if it is an error (i.e. negative value), then the "return flags" > form could result in a smaller output.
Well, this part of the code is not a hotspot, so IMHO readability counts first here. Hand-optimizations like you suggest are questionable and did at least confuse me. I had to look up fcntl man pages to assure that -1 is the only negative value that is ever returned. Before that I even checked the calls to wgnutls_read_timeout() to see what is being done with the returned value. A simple 'return -1' just helps the programmer to maintain the code by saving his precious time ! > Cheers, > Giuseppe Regards, Tim
