Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!decvax!genrad!panda!talcott!harvard!seismo!brl-adm!brl-smoke!smoke!jon@cit-vax.ARPA From: jon@cit-vax.ARPA (Jonathan P. Leech) Newsgroups: net.lang.c Subject: Re: Long Longs Message-ID: <1434@brl-smoke.ARPA> Date: Sun, 2-Mar-86 21:24:47 EST Article-I.D.: brl-smok.1434 Posted: Sun Mar 2 21:24:47 1986 Date-Received: Tue, 4-Mar-86 03:55:23 EST Sender: news@brl-smoke.ARPA Lines: 47 > From: "Robert D. Silverman" > Subject: Long Longs > > ... Various reasons for wanting 'long longs' deleted > > Does C++ have long longs? Does anyone know of ANY language that does? > (Bignums in Lisp don't qualify) > > Bob Silverman Some C compilers have them, especially if the hardware supports it. I know that C on ELXSI Unix and UTS (Amdahl) Unix has them. Note that (even if they were added to the ANSI standard) there is nothing prohibiting the COMPILER from generating function calls just as you would - many compilers already do this for floating point operations if there is no hardware f.p. - so there's no guaranteed speedup. You could define a class in C++ containg 64-bit longs and overload the normal arithmetic operations to work on them; getting it to generate the 'proper' code for int b, c, d; longlong result; result = (b * c) / d; would be more difficult. My limited experience with C++ makes me think that you would have to define a new class equivalent to int except that result of '*' is a longlong (or whatever you want to call it). C++ could generate such code inline. Final cautionary note: [ from K&R Appendix A Sec. 7 (pg 185) Expressions ]: "... Expressions involving a commutative and associative operator (*, +, &, |, ^) may be rearranged arbitrarily, even in the presence of parentheses; to force a particular order of evaluation an explicit temporary must be used." I believe the ANSI draft lets you specify order of evaluation with the unary '+' operator, so you would want a = +(b * c) / d; whenever ANSI compilers finally arrive. -- Jon Leech (jon@csvax.caltech.edu) __@/