On Tue, Jan 18, 2011 at 09:15:40PM -0800, Brian Koropoff wrote: > - Older Solaris does not support %jd (intmax_t) in format > strings, but it does support %lld (long long), which is > the same size on all architectures it supports. Do > a configure check for the sizes of both and prefer %lld > when it is safe to do so. Pedantically, that's a regression for systems that do support %jd, and I expect compilers to warn about it. If %jd is available, it must be used for intmax_t, and not %lld, because that is for long long, not intmax_t. What you can do is use PRIdMAX from <inttypes.h>, normally defined as "jd". You can then define this to "lld" or "jd" if it is not defined. I think this makes the code uglier (just like your change), but oh well. > - Older Solaris lacks stdint.h, but inttypes.h provides the > same types and works on all platforms I've tried dash on, > so just use it instead. <inttypes.h> is defined to be a superset of <stdint.h>, so that is ok. It is also needed for the PRIdMAX suggestion above. > [...] > diff --git a/src/arith_yacc.c b/src/arith_yacc.c > index 6c5a720..bf21830 100644 > --- a/src/arith_yacc.c > +++ b/src/arith_yacc.c > @@ -33,7 +33,6 @@ > */ > > #include <inttypes.h> > -#include <stdint.h> > #include <stdlib.h> > #include "arith_yacc.h" > #include "expand.h" This is useful regardless as the <stdint.h> is redundant. The <inttypes.h> is already needed here because of imaxdiv(). By the way, I wonder what the advantage of imaxdiv() above separate % and / is. Compilers can detect the matching between a % b and a / b and do it in one operation, and any use of imaxdiv() trips gcc's -Waggregate-return. -- Jilles Tjoelker -- To unsubscribe from this list: send the line "unsubscribe dash" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html