Subject: Re: PATCH: refactor memstream for "print -v"
From: Bart Schaefer <[email-masked]>
To: [email-masked]
Date: Fri, 8 Jan 2016 20:37:32 -0800
List-Id: Zsh Workers List <zsh-workers.zsh.org>

On Jan 8,  9:32pm, Jun T. wrote:
} 
} 2016/01/07 06:30, Bart Schaefer <[email-masked]> 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.