Topic: Undefined backslash escape sequences (Character Constants)


Author: coller@alhena.usc.edu (Lee D. Coller)
Date: 27 Apr 1994 11:24:38 -0700
Raw View
The last paragraph on page 9, section 2.5.2 (describing character
constants) of the ARM states:

 "If the character following a backslash is not one of those
 specified, the behavior is undefined."

Why is this undefined, and not an error?  It is a situation that the
compiler can easily detect, so why not make it an error?

My apologies for this question if this has been changed.  If not, I
would propose that the committee consider making thi an error.

The only reason that I could see for making this undefined is to allow
an implementation to define additional special charachters (\s,
shock-user?).  If we want to allow this wouldn't it be better if this
last sentence read:

 "Implementations may define additional special characters
 using backslash escape sequences.  If the character following
 the backslash is not defined for the implementation, it is an
 error."

Thus if the character is not defined for the implementation, than the
compiler would be required to flag it rather than possibly silently
accept it.

My ARM is the October 92 printing.
--
-----------------------------------------------------------------
Lee D. Coller (coller@alnitak.usc.edu)  +1 (310) 379-0844
USC Behavioral Technology Labs, 250 N. Harbor Dr. Ste 309
Redondo Beach, California, 90277




Author: lincmad@netcom.com (Linc Madison)
Date: Thu, 28 Apr 1994 05:24:46 GMT
Raw View
Lee D. Coller (coller@alhena.usc.edu) wrote:
: The last paragraph on page 9, section 2.5.2 (describing character
: constants) of the ARM states:

:  "If the character following a backslash is not one of those
:  specified, the behavior is undefined."

: Why is this undefined, and not an error?  It is a situation that the
: compiler can easily detect, so why not make it an error?

An example of a non-standard backslash escape character is \p, which is
used on the Macintosh to create a Pascal string.  For example, "\pfoo"
-- the '\p' takes on the value of the length byte, in this case 3.

As for the rest of your question, I don't know.

-- Linc Madison   *   Oakland, California   *   LincMad@Netcom.com