I assume that C didn't originate the idea that, for example, the sequence \t inside a string literal should mean a tab character, that \" should allow embedding a quote so that it isn't seen as the end of the string, etc.

But where did this idea come from? Did B, or BCPL come up with it? Or perhaps something older? Or was it even inspired by something that existed before what we'd call a "programming language" today?

And did languages before C happen to use the same set of escape sequences?

  • 1
    $\begingroup$ Doesn't this belong on retrocomputing.stackexchange.com? $\endgroup$
    – Adám
    Commented May 17 at 4:57
  • 1
    $\begingroup$ I think it's in line with other questions here in the tag, and the retrocomputing folks don't seem to talk about languages that are any more esoteric than Fortran, so I thought I'd get a better answer here. But if people think it should be moved, I won't object. $\endgroup$ Commented May 17 at 5:07
  • 5
    $\begingroup$ I think this question is a good fit for this site - it also leaves room open to answer 'why' it's used (which seems like something the question's asking). $\endgroup$
    – Redz
    Commented May 17 at 5:14
  • 2
    $\begingroup$ Duplicate? $\endgroup$
    – Adám
    Commented May 17 at 7:10
  • 2
    $\begingroup$ There are really two different things that backslash escapes area currently used for: firstly, as what some languages refer to as a "release character", to make the next character literal when it would normally have special meaning; and secondly, as part of a digraph, to represent some character that would otherwise be hard to include. It's possible the two have different histories. It's also unclear if you're interested in the idea of such sequences, or the specific use of backslash for them. $\endgroup$
    – IMSoP
    Commented May 17 at 9:04


You must log in to answer this question.

Browse other questions tagged .