Re: Usage of \ in Ada



Dmitry A. Kazakov wrote:
On Thu, 24 Aug 2006 10:37:21 +0200, Jean-Pierre Rosen wrote:

Adam Beneschan a écrit :
It's probably to prevent stupid errors. If you have a string literal
with an LF in it, it's far more likely (using a fairly traditional
representation of the source) that you've forgotten a closing quote
than that you intended to put a linefeed in the literal. And if the
language did try to allow a line separator in a string literal (even if
it were represented as something like \n in the representation)

And of course, if you really need an LF in a character string, just use
Ada.Characters.Latin_1.LF ....

Sure, but that is not the point.

Well, J-P's point is sort of pertinent. The question I was trying to
answer was, what was the reason for Ada not allowing control characters
inside string literals. And whatever reasons the authors might have
had for thinking allowing them was a bad idea, the fact is that it's
relatively easy in Ada to find another way to include such characters
in a string value, simply by using the concatenate operator and
A.C.L.LF or whatever, so there's no pressing need to find a way to
represent them inside string literals. Trying to do the same thing in
C, without using the special escape sequences, is pretty painful.

-- Adam

.



Relevant Pages

  • Re: How are string literals represented internally by compilers?
    ... How are string literals represented internally by ... When you say 'internally by compilers', it seems to me that you ... Those seem likely for the object code and run time representation ... the representation for the language that the compiler is written in. ...
    (comp.compilers)
  • Re: Strings and bindary data
    ... String to another file, are those files guaranteed to be identical? ... No. Strings are designed to hold textual data, and that /always/ is subject to ... beyond what is in its representation. ... representation -- that's to say a mapping from abstract characters (or ...
    (comp.lang.java.programmer)
  • Re: A problem to read a SEG-file using Fortran90 code on PC
    ... IBM EBCDIC codes for characters convert to normal ascii codes, ... from IBM mainframe sources.. ... If you have floating point values stored in a bit representation you ...
    (comp.lang.fortran)
  • Re: Koohaku Uta Gassen
    ... representation; one romaji representation, one kana" romanization scheme for any place where exact matching is important, ... be written entirely in characters available on the standard English keyboard) is the one I invented and use myself - which I would not remotely recommend putting into general use, despite how well it works for me. ... I've never come across *any* romanization scheme which had a consistent, easily comphrehensible means of representing those, other than my own, and that feature of my own is probably its clunkiest aspect. ... guts to start a new thread over: how do the Japanese refer to what I ...
    (sci.lang.japan)
  • Re: Converting fixed-to-free format
    ... The presumed physical representation of a line in that era was the first ... the 704 card reader only read 72 columns. ... for free form) characters of each line, with extra blanks added to get ... you'll conclude that pretty much nobody writes standard ...
    (comp.lang.fortran)