libgloss/arm/libcfunc.c: alarm [PATCH]

Dave Korn dave.korn@artimi.com
Fri Jul 15 10:36:00 GMT 2005


----Original Message----
>From: Nick Clifton
>Sent: 15 July 2005 09:25

>>>> +     return errno = ENOSYS, -1;
> 
>>> Ugg!  There is no need for clever coding here.  Use two statements not a
>>> comma, it is much clearer that way.  (There are several places where
>>> this applies).
> 
>> I think of setting errno and returning -1 as a single conceptual
>> operation, which is why I like the look of the above idiom, but fair
>> enough.
> 
> Well I guess we could argue about the exact significance of errno and
> return values but it just felt wrong to me.   Thanks for agreeing to
> change this.

  I'm in agreement with Nick.  It's too obfuscatory.  At a quick glance
over, it reads very much like "return errno {stuff...}"; the return
statement is too far separated from the actual thing being returned (the
-1), and as in writing, if your verb and noun are too widely separated, the
stuff in between makes the reader lose track and reduces the clarity of the
sentence.  If you want to group two statements together conceptually without
losing clarity, you can still put them on separate lines but group them
together with a blank line before and/or after.

> One thing though - since we are already using __attribute__((weak)) why
> not also use __attribute__((unused)) ?

  I was going to point this out as well.  One thing about it:

>  (Or the ATTRIBUTE_UNUSED macro
           ^^^^^^^^^^^^^^^
> less portable 
  ^^^^^^^^^^^^^

  Surely the ATTRIBUTE_UNUSED macro masks the gcc-centricness of the
attribute (by wrapping it in #ifdef _GNU_C or somesuch) and should be
considered thoroughly portable?


    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....



More information about the Newlib mailing list