[lkml]   [2004]   [Jan]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: GCC 3.4 Heads-up

    On Sun, 4 Jan 2004, Bill Davidsen wrote:
    > Your example, which I quoted, *is* standard C. And it avoids duplication
    > of code without extra variables, and is readable. We both agreed it was
    > standard, why have you canged your mind?

    Oh, that one. I thought you were talking about the gcc extension.

    My version is not what I'd call really readable unless you actually have
    an agenda to access the variable though a pointer. In fact, the only case
    where I have actually seen constructs like that is literally when you want
    to avoid a branch for some specific reason, and you do something like

    int branchless_code(int *ptr)
    int dummy;

    *(ptr ? ptr : &dummy) = value;

    it you'd rather do a unconditional store through a conditional pointer
    than have a conditional store, and you use a dummy "sink" variable to take
    the store if the condition isn't true.

    Some compilers apparently generate this kind of code internally from
    conditional statements. I've never seen gcc do it, though.

    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2009-11-18 23:46    [W:0.020 / U:4.112 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site