lkml.org 
[lkml]   [2000]   [Oct]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: Patch to remove undefined C code
    Date
    From
    Bernd Schmidt <bernds@redhat.co.uk> said:
    > On Tue, 17 Oct 2000, Richard Guenther wrote:
    > > On Tue, 17 Oct 2000, Bernd Schmidt wrote:
    > > > On Tue, 17 Oct 2000, Richard Guenther wrote:
    > > > > The following one is wrong, tho - should be rather
    > > > > str[i] = dn[i]; i++;
    > > >
    > > > Nope. (Well, at least you need to add extra braces.) The comma is a
    > > > sequence point.

    > > Umm, I thought, dn[i], i++ evaluates to i and dn[i++] evaluates
    > > to dn[i], so it should be either i++, dn[i-1] or the one I showed
    > > above?

    > According to operator precedence rules,
    > str[i] = dn[i], i++;
    > is equivalent to
    > (str[i] = dn[i]), i++;

    > Comma has the lowest precedence of all C operators.

    If knowledgeable C users have doubts on the code's meaning, *rewrite
    it*. This is just misunderstandings (and bugs) waiting for the unwary.
    --
    Dr. Horst H. von Brand mailto:vonbrand@inf.utfsm.cl
    Departamento de Informatica Fono: +56 32 654431
    Universidad Tecnica Federico Santa Maria +56 32 654239
    Casilla 110-V, Valparaiso, Chile Fax: +56 32 797513
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-03-22 12:41    [W:0.020 / U:209.452 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site