Re: BOZ literal constants, a puzzle for us Standard-loving types.



glen herrmannsfeldt wrote:
Brooks Moses wrote:
My interpretation would be that the standard isn't, per se, outlawing this _as an extension_. The behavior when an integer is out of range is undefined, and I think it would not be amiss for a compiler to adjust its range-checking to allow for this usage as a special case, considering assignments from a BOZ-literal to an integer to be out of range only when there are too many bits.

It could even allow it when there are too many bits, as far as I know.

It could. I would consider that a failure of the range-checking to act "as advertised", however -- what I meant there is not about what the standard allows (which is quite lenient), but what I'd consider to be a good quality of implementation within that.

I should also be clear that I think it's fine for compilers not to do constant range-checking, but I'm talking about the situation where one's asked (via a command-line option, or by not turning off one that's on by default) for ranges to be checked.

- Brooks


--
The "bmoses-nospam" address is valid; no unmunging needed.
.



Relevant Pages

  • Re: ProDOS Plus
    ... Apple II's and ProDOS. ... They never wrote a compiler that wouldn't fit in half the memory ... Any practical extension will have to fit within the memory envelope ... I don't think any OS has ever maintained 100% compatibility with previous versions. ...
    (comp.sys.apple2)
  • Re: Multi precision floating point
    ... It's been stated in this thread that a Fortran program is not actually ... But consider a hypothetical compiler that acts as a conforming C ... as an *extension* provided by a conforming C implementation. ...
    (comp.lang.c)
  • Re: more idle thinking: SiMPL
    ... I am thinking of an odd piece of syntax: ... by extension: ... treatment of ';' could be a little more flexible than in C family languages, ... likely make an unreasonable headache for the compiler (AKA: ...
    (comp.lang.misc)
  • Re: Multi precision floating point
    ... extension is a string function called strdup. ... If it compiles on every ideal, conforming C compiler then it requires ... I believe that one common technique for using the features that you correctly point out are not part of standard C is to wrap them into a small part of your program, and write the main part in Standard C which calls a wrapper function when it wants to use a nonstandard feature. ...
    (comp.lang.c)
  • Re: Announcing: CHICKEN 2.3
    ... the `chicken-config' script has been removed, ... Generates tail-recursive C with full support for first-class ... The compiler can be customized in various ways. ... of extension libraries. ...
    (comp.lang.scheme)