> in fact, it works with any compiler by necessity, as the assignment to char
> variables MUST truncate the result.
> 
> the masking in line 12 is necessary, because there is no assignment.
> https://stackoverflow.com/questions/46073295/implicit-type-promotion-rules
> explains the deeper problem.

To quote this page "These rules are often not even known by the
average C programmer and therefore causing all manner of very subtle
bugs."

Would it make the code more clear to mask it to 0xff or mod it % 256?
Would it hurt anything?  It may avoid some bug in the future if
someone comes along and modifies this code without knowing this nuance
of C.

Anyway, it currently works, just wanted to be sure it wasn't a
potential bug.

Michael Grant

Attachment: signature.asc
Description: PGP signature

_______________________________________________
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to