[tex-k] Precision warnings

Doug McKenna doug at mathemaesthetics.com
Sat Oct 26 21:10:40 CEST 2019


After a successful port of the kpsewhich tool and the kpathsea source code to XCode's IDE, the compiler tells me that there are about 40 places in the source files where there are assignments of 64-bit (typically size_t) integers to local variables of type |int| or |unsigned|, which are both 32-bit.  30 of these instances involve assigning the result of strlen() to an unsigned int.  Most of the rest involve passing pointer expressions to subroutines that take ints.  A couple of final warnings are where system library routines delivers ssize_t answers, assigned to ints, or size_t answers assigned to unsigned.

Each represents a formal loss of precision, but of course we all know that no path string is ever going to breach a signed |int| in length, so in practice, nothing bad happens.

I'm happy to take the time to report the exact positions of where these warnings are and how I've adjusted my ported code to make them all go away.  But I don't really know what other official TeX utility maintainers' policy is on the subject, because it involves overriding the compiler with casts in most cases, which is (again, formally) not a good thing to do.


Doug McKenna


More information about the tex-k mailing list