On Thu, 2004-02-26 at 12:47, Andras Erdei wrote:
> is there any reason to list individuals beside the list address?
> should i do it, too?
No there isn't. I just always click "Reply to All" because of work
emails where I cannot be sure that everyone in CC: is a member of the
relevant lists and often we use several different lists so you have to
reply to all of them... Sorry if that means you get everything twice...
> On Thu, 26 Feb 2004 12:21:52 +0100 (MET), Szakacsits Szabolcs <sz...@si...> wrote:
> >> - /* Need two bytes for null terminator. */
> >> - maxlen -= 2;
> >> + /* Convert maxlen from bytes to unicode characters. */
> >> + maxlen /= sizeof(uchar_t);
> >> + /* Need space for null terminator. */
> >> + maxlen--;
>
> >This is still wrong. If maxlen was <= 1 and src was bigger, then we have a
> >buffer overflow (currently it never should occure as Anton also pointed
> >out). Only Andras 3rd solution was correct.
>
> the options:
> - an if()
> - an assert()
> - a comment
>
> i assumed the if() was intentionally left out (efficiency :O),
No, it was forgotten. )-:
> >Personally I prefer when by reading the code, it documents itself without
> >explicit /* */ or // comments. Real comments are for non-trivial things,
> >things that's thought but not in the code, function description, FIXME's,
> >etc.
>
> i don't know what kind of audience are you targeting with this
> code; and you may be right, not using ((almost) trivial) comments
> may actually be helpful as it raises the entry treshold and can
> prevent well-meaning newbies from poking around with the code and
> hurting themselves
Good question about the audience. I think I try to make the code
readable enough so that if I read it a year later I can easily
understand what it does and can fix bugs / make additions / etc... And
even though maybe I write too many comments I have never so far seen any
of the libntfs or ntfs kernel code (new driver) that I couldn't
understand immediately so I think I will keep this style for myself. It
seems to work for me so why change it. (-;
Best regards,
Anton
--
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Unix Support, Computing Service, University of Cambridge, CB2 3QH, UK
Linux NTFS maintainer / IRC: #ntfs on irc.freenode.net
WWW: http://linux-ntfs.sf.net/ &
http://www-stu.christs.cam.ac.uk/~aia21/
|