I've yet to hear that anyone actually used trigraphs. - Weren't they,
because of that, even removed from recent "C" (or C++) standards?
A <iso646.h> style is better, where someone lacking a ^ key can
write "xor" instead.
I don't know what the <iso646.h> header actually is. - The "problem"
with "ISO 646" is that there's many (national) variants of it. - If
we're speaking about the ISO 646 IRV (International Reference Version) there's a '^' available at least. (Which doesn't mean it's available
on specific national keyboards, though.)
]<% {
}%: #
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
[...]
I've yet to hear that anyone actually used trigraphs. - Weren't they,
because of that, even removed from recent "C" (or C++) standards?
I've used trigraphs, but only in deliberately obfuscated code. I'm not
aware of any code that uses trigraphs because they're useful.
Part of the point of trigraphs was to enable the use of C on
EBCDIC-based systems that don't have all the characters C requires,
including '{' and '}'. (There are EBCDIC code pages that do have those >characters, but they're outside the "invariant subset".)
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
[...]
I've yet to hear that anyone actually used trigraphs. - Weren't they,
because of that, even removed from recent "C" (or C++) standards?
I've used trigraphs, but only in deliberately obfuscated code. I'm not >>aware of any code that uses trigraphs because they're useful.
Part of the point of trigraphs was to enable the use of C on
EBCDIC-based systems that don't have all the characters C requires, >>including '{' and '}'. (There are EBCDIC code pages that do have those >>characters, but they're outside the "invariant subset".)
The other part may have been for those still using ASR-33 teletypes
which were missing several characters required in C, including
curly braces, vertical bar, backtick and tilde.
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
[...]
It's possible that trigraphs have been used accidentally more often
than they've been used intentionally:
fprintf(stderr, "What the heck just happened??!\n");
Even more fun (though this is deliberately contrived, not accidental)
(??/ expands to \) :
#include <stdio.h>
int main(void) {
// Is this a multi-line comment ??/
if (1) puts("No, it isn't."); else
puts("Yes, it is.");
}
Yes, trigraphs were removed in the C23 standard. (C++ removed them
in C++17.)
A <iso646.h> style is better, where someone lacking a ^ key can
write "xor" instead.
I don't know what the <iso646.h> header actually is. - [...]
<iso646.h> is a standard header, introduced in the 1995 amendment
to the C90 standard. It defines 11 macros, intended for use on
systems that use character sets that *aren't* compatible with ISO
646 (basically 7-bit ASCII), or at least that make it difficult
to use certain ASCII characters. [...]
[...]
<iso646.h> and digraphs operate on the token level. Trigraphs are
(were) replaced in translation phase 1, so they can be used in
character constants, string literals, header names, comments,
and so forth.
[...]--- Synchronet 3.22a-Linux NewsLink 1.2
(BTW, in my youth I had specified some detailed semantics (and
connotations) for the textual multiplication of '?' and '!' up
to a length of 3 - it had not been common to express more than
expressible with the single signs. I considered it worthy since
the expressive power of plain '!' and '?' wasn't sufficient for
the finer tones.)
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
[...]
(BTW, in my youth I had specified some detailed semantics (and
connotations) for the textual multiplication of '?' and '!' up
to a length of 3 - it had not been common to express more than
expressible with the single signs. I considered it worthy since
the expressive power of plain '!' and '?' wasn't sufficient for
the finer tones.)
Really??? Tell me more!!!
r+yr+yr+yOr maybe notrC+rC+rC+
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
[...]
(BTW, in my youth I had specified some detailed semantics (and
connotations) for the textual multiplication of '?' and '!' up
to a length of 3 - it had not been common to express more than
expressible with the single signs. I considered it worthy since
the expressive power of plain '!' and '?' wasn't sufficient for
the finer tones.)
Really??? Tell me more!!!
r+yr+yr+yOr maybe notrC+rC+rC+
scott@slp53.sl.home (Scott Lurndal) writes:
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
[...]
I've yet to hear that anyone actually used trigraphs. - Weren't they,
because of that, even removed from recent "C" (or C++) standards?
I've used trigraphs, but only in deliberately obfuscated code. I'm not
aware of any code that uses trigraphs because they're useful.
Part of the point of trigraphs was to enable the use of C on
EBCDIC-based systems that don't have all the characters C requires,
including '{' and '}'. (There are EBCDIC code pages that do have those
characters, but they're outside the "invariant subset".)
The other part may have been for those still using ASR-33 teletypes
which were missing several characters required in C, including
curly braces, vertical bar, backtick and tilde.
Apparently the ASR-33 generated 7-bit ASCII, but didn't support
lowercase letters.
The stty command had (and still has, at least in some versions)
options to map uppercase characters to lowercase, and to generate
uppercase with a '\' prefix, so Hello would be entered as \HELLO.
I suppose a C programmer would likely be using a line editor like
"ed" to edit code, which would be subject to the current tty
settings, and since C is mostly lowercase the translation would
make it tolerable.
I wonder how many ASR-33s were still in use for C development by
the time <iso646.h> and trigraphs were introduced in 1995.
On 10/09/2026 23:48, Keith Thompson wrote:
scott@slp53.sl.home (Scott Lurndal) writes:
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:The other part may have been for those still using ASR-33 teletypes
[...]
which were missing several characters required in C, including
curly braces, vertical bar, backtick and tilde.
(Where does C require backtick?)
On 10/09/2026 23:48, Keith Thompson wrote:
scott@slp53.sl.home (Scott Lurndal) writes:
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> writes:
[...]
I've yet to hear that anyone actually used trigraphs. - Weren't they, >>>>> because of that, even removed from recent "C" (or C++) standards?
I've used trigraphs, but only in deliberately obfuscated code. I'm not >>>> aware of any code that uses trigraphs because they're useful.
Part of the point of trigraphs was to enable the use of C on
EBCDIC-based systems that don't have all the characters C requires,
including '{' and '}'. (There are EBCDIC code pages that do have those >>>> characters, but they're outside the "invariant subset".)
The other part may have been for those still using ASR-33 teletypes
which were missing several characters required in C, including
curly braces, vertical bar, backtick and tilde.
(Where does C require backtick?)
Apparently the ASR-33 generated 7-bit ASCII, but didn't support
lowercase letters.
The stty command had (and still has, at least in some versions)
options to map uppercase characters to lowercase, and to generate
uppercase with a '\' prefix, so Hello would be entered as \HELLO.
I suppose a C programmer would likely be using a line editor like
"ed" to edit code, which would be subject to the current tty
settings, and since C is mostly lowercase the translation would
make it tolerable.
I wonder how many ASR-33s were still in use for C development by
the time <iso646.h> and trigraphs were introduced in 1995.
I used ASR33s and other terminals with various limitations from 1976.
The first computer I /made/ used 6-bit (I think, ASCII codes 32 to 95
offset to be 0 to 63, so upper-case only), in 1981.
How did people even write C on such systems?
It does work, but I have to use Notepad to view it
| Sysop: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 74 |
| Nodes: | 6 (0 / 6) |
| Uptime: | 121:16:07 |
| Calls: | 1,194 |
| Files: | 1,352 |
| Messages: | 290,208 |