Article View: comp.std.c
Article #3682Re: Why "long long" doesn't work.
From: Richard A. O'Keefe
Date: Wed, 09 Aug 1995 05:07
Date: Wed, 09 Aug 1995 05:07
51 lines
3015 bytes
3015 bytes
hjp@wsrdb.wsr.ac.at (Peter Holzer) writes:
>D might be an embedded system which cannot produce a header file
*Argh*. I forgot about that possibility. Thank you for pointing it out.
I used to have a .signature "the longer I use C, the better I like Ada."
Seriously, I would _much_ rather the C9X committee spent a lot of effort
trying to solve the "environment enquiry" and "type selection" problems
than copying things from C++. The last time I looked, C++ still hadn't
solved those problems itself.
Type selection problem:
I need a signed integral type that can hold a certain range of numbers.
How do I ask for that _portably_?
Yes, I know I can use the standard-guaranteed limits to get a type
which is guaranteed to be big enough, but it might be inefficient.
What's more, if the bounds of the type are _computed_ the actual
bounds may vary from installation to installation.
Imagine something like signed<LowExpr, HighExpr>.
I need an unsigned integral type that can hold a certain range of numbers.
How do I ask for that _portably_?
Same problems. Imagine unsigned<MaxExpr>.
I need a floating point type with a certain precision and/or a certain
range. How do I ask for that _portably_?
float<X,Y> meaning a floating point type that can represent both
X and Y as distinct values would do the job.
How can I solve these problems without a tangle of bizarre syntax?
The samples above use C++-like notation FAMILY<e1,...,en> meaning the
"cheapest" member of the family that can represent all the listed
numbers distinctly. We still need a way to say optimise for time/
optimise for space/use exactly N bits, but _please_ let's not have as
much syntax as recent proposals here have suggested.
Environment enquiry problem:
I have a type, or a variable of that type.
How do I find out its properties _portably_?
This includes but is not limited to things like minimum value, maximum
value, printf format, scanf format, number of bits, representation (is
it 2s-comp, 1s-comp, sign-and-magnitude, ieee 754, whatever), and how
do I do this WITHOUT cluttering up the name space with a huge number of
special values.
--
"conventional orthography is ... a near optimal system for the
lexical representation of English words." Chomsky & Halle, S.P.E.
Richard A. O'Keefe; http://www.cs.rmit.edu.au/~ok; RMIT Comp.Sci.
Technical Details
Message-ID:
<409fr9$guo@goanna.cs.rmit.edu.au>Path:
arc1-ca.pugleaf.net!goanna.cs.rmit.edu.au!not-for-mailReferences:
<3uvcje$c3q@goanna.cs.rmit.edu.au> <3v34qv$hev@newsbf02.news.aol.com> <3va1o3$aas@goanna.cs.rmit.edu.au> <3vq4p5$8dv@wsrcom.wsr.ac.at>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!goanna.cs.rmit.edu.au!not-for-mail From: ok@goanna.cs.rmit.edu.au (Richard A. O'Keefe) Newsgroups: comp.std.c Subject: Re: Why "long long" doesn't work. Date: 9 Aug 1995 15:07:53 +1000 Organization: Comp Sci, RMIT, Melbourne, Australia Message-ID: <409fr9$guo@goanna.cs.rmit.edu.au> References: <3uvcje$c3q@goanna.cs.rmit.edu.au> <3v34qv$hev@newsbf02.news.aol.com> <3va1o3$aas@goanna.cs.rmit.edu.au> <3vq4p5$8dv@wsrcom.wsr.ac.at> NNTP-Posting-Host: goanna.cs.rmit.edu.au NNTP-Posting-User: ok X-Newsreader: NN version 6.5.0 #0 (NOV)