Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: refactor memstream for "print -v"



On Jan 8,  9:32pm, Jun T. wrote:
} 
} 2016/01/07 06:30, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
} 
} > I suppose that this:
} > 
} >    ((COUNT = fread(BUF, 1, count, FOUT)) == count)
} > 
} > could correctly be replaced with
} > 
} >    (count == (count = fread(BUF, 1, count, FOUT)))
} 
} So you want to save the return value of fread() for debugging purpose?

Yes.  However:

} builtin.c:4435:36: warning: unsequenced modification and access to 'count' [-Wunsequenced]

That warning means my attempt was not successful; there's not a proper
sequence point in that expression.

} Anyway, I feel the macro is too complicated, so how about either
} 
} (b) give up saving the return value of fread()
}    ( .... && (count == fread(BUF, 1, count ,FOUT))) ? count : (size_t)-1 )

Agree that's probably the way to go.

} Sorry for taking your time.

Do not apologize, this is good.  Might be avoided if I had a test system
handy with clang on it, but I presently do not.



Messages sorted by: Reverse Date, Date, Thread, Author