James Carlson <carls...@workingcode.com> wrote:

> > You Most of the code I see from Sun does not follow 
> > these rules and the variable names are of course OK in a piece of code that
> > is easy to read (all string sources in ON use tose 's' variables..... 
> > Note that K&K function _implemetations_ are needed for portability and that 
> > there is no benefit from using ANSI C here as there are ANCI C function 
> > _declarations_.
> > 
> > I hope you know the difference between a function "declaration" and a 
> > function
> > "implementation".
>
> Read the C style guide on the web site and try again.

Irrelevant as long as nearly all current code in ON is similar to mine.

> >> It may be easier just to make "len == 0" a single special case on entry:
> >>
> >>    if (len == 0)
> >>            return (0);
> >>    while (*rs++ != '\0' && --len > 0)
> >>            ;
> >>    if (len == 0)
> >>            return (rs - s);
> >>    else
> >>            return ((rs - s) - 1);
> > 
> > Your code is incorrect an not acceptable to me. 
> > 
> > Your code tries to access more than "len" chars from the string, which is 
> > forbidden by the standard. Note that there is similar incorrect code in libc
> > from Solaris that either accesses more data than permitted or does not work
> > correctly with len == ~0.
>
> No, it doesn't access more than "len" characters from the string under
> any circumstances.  You are wrong.

Well, you are wrong as line is unsigned.

Jörg

-- 
 EMail:jo...@schily.isdn.cs.tu-berlin.de (home) Jörg Schilling D-13353 Berlin
       j...@cs.tu-berlin.de                (uni)  
       joerg.schill...@fokus.fraunhofer.de (work) Blog: 
http://schily.blogspot.com/
 URL:  http://cdrecord.berlios.de/private/ ftp://ftp.berlios.de/pub/schily
_______________________________________________
opensolaris-code mailing list
opensolaris-code@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to