tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: int vs. long in test(1)




On Jun 20, 2008, at 3:22 AM, Alan Barrett wrote:

On Thu, 19 Jun 2008, James Chacon wrote:
sh(1)'s test (-current/amd64) doesn't deal with big numbers (> MAXINT)
I think it would make sense to use intmax_t.  We already do that for
the integers in shell arithmatic with the $((...)) syntax.

Isn't that wrong then for 64bit machines where int is 32 and the spec says
"signed long" is what should be used here?

I don't see anything in the spec about integer sizes.  I am looking at
<http://www.opengroup.org/onlinepubs/009695399/utilities/test.html>.

intmax_t, being the largest signed integer type supported by the
compiler, is guaranteed to be at least as large as "signed long", and
may be larger. Where do you see a spec that requires "signed long" and
forbids anything larger than that?

Never said it forbid anything larger. I just got confused about intmax_t was all.

James



Home | Main Index | Thread Index | Old Index