Re: Integer Coersion



PJH wrote:
(snip)

In comparison, an intrinsic that gives you the bit length of a fp type kind
and ont that gives the bit size of a Byte is trivial (provided of course you
can get a standard definitin of a Byte - smallest addressable memory
location size?).

There have been discussions about bits per char for C implementations
on the 36 bit PDP-10. Most likely either 9 or 18, it being a little
easier to operate on 18 bit half words. Some CRAY machines have a
64 bit word as the smallest addressable unit, and maybe even with
C char of 64 bits.

For Fortran, even if bytes are not a particularly sensible option for
defining type kinds, I would certainly like the option of defining by
minimum number of bits rather than numeric ranges.

If the numeric ranges were in powers of two, would that be close
enough? The remaining problem is that twos complement allows
-(2**(N-1)), where ones complement and sign magnitude don't.
Even C still allows for those.

(snip)

I keep reading posts on this ng that describe all sorts of gloomy
portability scenarios, but, with little experience outside of PCs and a bit
of VAX/VMS in the dim and distant past, I have no real way to judge how
credible this doom-mongering is in current reality. Are there still
systems/compilers out there that radically depart from a "normal"
implementation and for which new fortran code is being produced? Or is the
doom'n'gloom the result of painful past memories before such a thing as a
"normal" implemetation existed?

They are disappearing fairly fast. I believe Unisys still sells a
ones complement machine, though I don't know the word size.
Most of the 64 bit Cray machines are in museums by now.

Still, as long as the standard allows for other word sizes, bases,
and representations for negative numbers standard conforming code
should follow the rules.

If you say at the top: "This code assumes eight bit bytes"
you code may be non-standard, but will run on a large number
of machines. Users will have been warned.

-- glen

.



Relevant Pages

  • Re: Getting started
    ... snip ... ... That's because you seem to be defining "standard" to mean "written ... Even though I used z80 coding for DOSPLUS, ...
    (comp.os.cpm)
  • Re: Draft standards OK for new compiler and libc?
    ... > Sort of true and sort of false. ... > not to usurp the standard's role in defining the C language. ... > need to develop the official standard. ...
    (comp.std.c)
  • Re: Freeing memory - will it be available immediately
    ... properly free'd is made available for "further allocation". ... The C standard defines the expected behaviour of a C program. ... The C standard defines free as releasing the memory to be made available ... exactly what the standard is defining the behaviour of, ...
    (comp.lang.c)
  • Re: What does ((time_t)-1) mean?
    ... standard, as long as you don't use anything related to the way ... If, for example, defining your own printf() function invokes UB, ...
    (comp.lang.c)
  • Re: Freeing memory - will it be available immediately
    ... properly free'd is made available for "further allocation". ... The C standard defines the expected behaviour of a C program. ... The C standard defines free as releasing the memory to be made available ... exactly what the standard is defining the behaviour of, ...
    (comp.lang.c)