Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Trigraphs

Reply
Thread Tools

Trigraphs

 
 
Skarmander
Guest
Posts: n/a
 
      11-07-2005
Lew Pitcher wrote:
> Jordan Abel wrote:
>
>>>On Mon, 07 Nov 2005 00:49:47 GMT, in comp.lang.c , Daniel Rudy
>>><(E-Mail Removed)> wrote:
>>>
>>>>What exactly are trigraphs, and why are they undesireable?

>
> [snip]
>
>>The problem is with non-US ones, or, more like,
>>non-us iso646 codesets, which actually don't contain some of
>>$[\]{|}~_^@`

>

$, @ and ` are never necessary to write portable C. How you get your
application's strings encoded is another problem.

> Or even US non-iso646 codesets, like the EBCDIC-* variations that IBM
> mainframes use.
>

EBCDIC has many funky versions, but do you actually know ones that do
not have the characters of the C trigraph set (# [ \ ] ^ { | } ~)? (This
is a genuine question, not an attempt at being snarky.)

Now, the ISO 646 variation of the Danish national character set, for
example, does not in fact have [ \ ] { | }; in their stead are .

I sincerely doubt Danish C programmers need trigraphs so they can use
this character set to code in, however; most will probably have ISO
8859-1 compatible platforms. With cross-compilers, if necessary. Or else
they ought to have compilers that read as [.

S.
 
Reply With Quote
 
 
 
 
Keith Thompson
Guest
Posts: n/a
 
      11-08-2005
Skarmander <(E-Mail Removed)> writes:
> Mark McIntyre wrote:
>> On Mon, 07 Nov 2005 00:49:47 GMT, in comp.lang.c , Daniel Rudy
>> <(E-Mail Removed)> wrote:
>>
>>>What exactly are trigraphs, and why are they undesireable?

>> They're not. You just try writing C code on a Mac G4 with a US
>> keyboard.

>
> Even when trigraphs solve the problem, they are arguably an inferior
> solution compared to just about every alternative: redefined keyboard
> layouts, editors with macro capabilities, search-and-replace of
> system-specific characters that are not so easily mistaken for genuine
> character sequences, getting a platform with support for all the
> characters in that newfangled contraption "ASCII". (Just in case.
>
> It's hard to see why this admittedly annoying problem of input should
> be solved by extending the C language. Mandating that every
> implementation should have on-demand support for trigraphs would have
> been just about acceptable, but unfortunately the standard just
> requires them to be always on.
>
> "Trigraphs: for when even ASCII is too much to ask for..."


The 'A' in ASCII stands for American. There are character sets that
are similar to ASCII except for the substitution of accented letters
for some of the punctuation marks. I *think* these have largely been
superseded by 8-bit and larger character sets that have plenty of room
for both puncutation characters and accented letters, so the need for
trigraphs is less than it was when they were introduced back in the
last 1980s.

If I recall correctly, one of the European national bodies insisted on
some solution for the national character set problem before they would
ratify the standard (I'm not sure whether they insisted on trigraphs
in particular). It was basically a political decision. I'm sure the
details are googleable.

--
Keith Thompson (The_Other_Keith) http://www.velocityreviews.com/forums/(E-Mail Removed) <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
 
Reply With Quote
 
 
 
 
Skarmander
Guest
Posts: n/a
 
      11-08-2005
Keith Thompson wrote:
> Skarmander <(E-Mail Removed)> writes:
>
>>Mark McIntyre wrote:
>>
>>>On Mon, 07 Nov 2005 00:49:47 GMT, in comp.lang.c , Daniel Rudy
>>><(E-Mail Removed)> wrote:
>>>
>>>
>>>>What exactly are trigraphs, and why are they undesireable?
>>>
>>>They're not. You just try writing C code on a Mac G4 with a US
>>>keyboard.

>>
>>Even when trigraphs solve the problem, they are arguably an inferior
>>solution compared to just about every alternative: redefined keyboard
>>layouts, editors with macro capabilities, search-and-replace of
>>system-specific characters that are not so easily mistaken for genuine
>>character sequences, getting a platform with support for all the
>>characters in that newfangled contraption "ASCII". (Just in case.
>>
>>It's hard to see why this admittedly annoying problem of input should
>>be solved by extending the C language. Mandating that every
>>implementation should have on-demand support for trigraphs would have
>>been just about acceptable, but unfortunately the standard just
>>requires them to be always on.
>>
>>"Trigraphs: for when even ASCII is too much to ask for..."

>
>
> The 'A' in ASCII stands for American.


I'll admit to a little pro-American bias in this case...

Actually, I stress that I used ASCII here only as a lowest-common
denominator of which the characters (not the encoding itself) are
accepted as lowest-common denominator just about everywhere. That is,
even if you're not using ASCII, you'll very likely be able to represent
the printable ASCII characters in your character set.

> There are character sets that are similar to ASCII except for the
> substitution of accented letters for some of the punctuation marks.


There are, but they're not common, and not used for coding your C source
for exactly this reason.

> I *think* these have largely been superseded by 8-bit and larger
> character sets that have plenty of room for both puncutation
> characters and accented letters, so the need for trigraphs is less
> than it was when they were introduced back in the last 1980s.
>


Yes. Notwithstanding this, my remark on superior solutions stands. These
would have been workable in the 1980s too.

> If I recall correctly, one of the European national bodies insisted on
> some solution for the national character set problem before they would
> ratify the standard (I'm not sure whether they insisted on trigraphs
> in particular). It was basically a political decision. I'm sure the
> details are googleable.
>


Politics would make more sense than technical limitations, yes. I'll
look up the full story someday. (Haven't found it yet, but I'm sure it's
been discussed before.)

S.
 
Reply With Quote
 
Christian Bau
Guest
Posts: n/a
 
      11-08-2005
In article <(E-Mail Removed)>,
Jordan Abel <(E-Mail Removed)> wrote:

> On 2005-11-07, Mark McIntyre <(E-Mail Removed)> wrote:
> > On Mon, 07 Nov 2005 00:49:47 GMT, in comp.lang.c , Daniel Rudy
> > <(E-Mail Removed)> wrote:
> >
> >>
> >>What exactly are trigraphs, and why are they undesireable?

> >
> > They're not.
> >
> > You just try writing C code on a Mac G4 with a US keyboard.

>
> US keyboards aren't the problem. What characters are missing from your
> Mac's US keyboard? The problem is with non-US ones, or, more like,
> non-us iso646 codesets, which actually don't contain some of
> $[\]{|}~_^@`


You could enter all these characters even on a German Apple II computer
around 1980 or so (the only problem is that there was no C compiler, but
writing Pascal programs would have been a major pain without all these
characters).
 
Reply With Quote
 
Jordan Abel
Guest
Posts: n/a
 
      11-08-2005
On 2005-11-07, Skarmander <(E-Mail Removed)> wrote:
> Lew Pitcher wrote:
>> Jordan Abel wrote:
>>
>>>>On Mon, 07 Nov 2005 00:49:47 GMT, in comp.lang.c , Daniel Rudy
>>>><(E-Mail Removed)> wrote:
>>>>
>>>>>What exactly are trigraphs, and why are they undesireable?

>>
>> [snip]
>>
>>>The problem is with non-US ones, or, more like,
>>>non-us iso646 codesets, which actually don't contain some of
>>>$[\]{|}~_^@`

>>

> $, @ and ` are never necessary to write portable C. How you get your
> application's strings encoded is another problem.


I listed those for completeness. Unfortunately, such completeness was
hurt by the fact that i forgot #.
 
Reply With Quote
 
Mark McIntyre
Guest
Posts: n/a
 
      11-08-2005
On Mon, 7 Nov 2005 22:58:18 +0000 (UTC), in comp.lang.c , Jordan Abel
<(E-Mail Removed)> wrote:

>On 2005-11-07, Mark McIntyre <(E-Mail Removed)> wrote:
>> On Mon, 07 Nov 2005 00:49:47 GMT, in comp.lang.c , Daniel Rudy
>> <(E-Mail Removed)> wrote:
>>
>>>
>>>What exactly are trigraphs, and why are they undesireable?

>>
>> You just try writing C code on a Mac G4 with a US keyboard.

>
>US keyboards aren't the problem. What characters are missing from your
>Mac's US keyboard?


There's no hash key.....
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
 
Reply With Quote
 
Richard Tobin
Guest
Posts: n/a
 
      11-08-2005
In article <(E-Mail Removed)>,
Mark McIntyre <(E-Mail Removed)> wrote:

>>US keyboards aren't the problem. What characters are missing from your
>>Mac's US keyboard?

>
>There's no hash key.....


Really? I thought that was just on UK keyboards. What do you have
on shift-3?

Mac UK keyboards have the sterling symbol, and hash is available as
alt-3, which is a real pain if you use normal keyboards too.

-- Richard
 
Reply With Quote
 
Jordan Abel
Guest
Posts: n/a
 
      11-09-2005
On 2005-11-08, Mark McIntyre <(E-Mail Removed)> wrote:
> On Mon, 7 Nov 2005 22:58:18 +0000 (UTC), in comp.lang.c , Jordan Abel
> <(E-Mail Removed)> wrote:
>
>>On 2005-11-07, Mark McIntyre <(E-Mail Removed)> wrote:
>>> On Mon, 07 Nov 2005 00:49:47 GMT, in comp.lang.c , Daniel Rudy
>>> <(E-Mail Removed)> wrote:
>>>
>>>>
>>>>What exactly are trigraphs, and why are they undesireable?
>>>
>>> You just try writing C code on a Mac G4 with a US keyboard.

>>
>>US keyboards aren't the problem. What characters are missing from your
>>Mac's US keyboard?

>
> There's no hash key.....


What's on shift-3?
 
Reply With Quote
 
Keith Thompson
Guest
Posts: n/a
 
      11-09-2005
Mark McIntyre <(E-Mail Removed)> writes:
> On Mon, 7 Nov 2005 22:58:18 +0000 (UTC), in comp.lang.c , Jordan Abel
> <(E-Mail Removed)> wrote:
>
>>On 2005-11-07, Mark McIntyre <(E-Mail Removed)> wrote:
>>> On Mon, 07 Nov 2005 00:49:47 GMT, in comp.lang.c , Daniel Rudy
>>> <(E-Mail Removed)> wrote:
>>>>What exactly are trigraphs, and why are they undesireable?
>>>
>>> You just try writing C code on a Mac G4 with a US keyboard.

>>
>>US keyboards aren't the problem. What characters are missing from your
>>Mac's US keyboard?

>
> There's no hash key.....


Was "US keyboard" a typo for "UK keyboard"?

(Even if I had to use a keyboard with no '#' key, I'd try to find a
solution other than trigraphs. I'd at least filter the source code
before distributing it.)

--
Keith Thompson (The_Other_Keith) (E-Mail Removed) <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
 
Reply With Quote
 
Peter Nilsson
Guest
Posts: n/a
 
      11-09-2005
Mark McIntyre wrote:
> > > You just try writing C code on a Mac G4 with a US keyboard.

> >
> > US keyboards aren't the problem. What characters are missing from your
> > Mac's US keyboard?

>
> There's no hash key.....


If the alternative keystrokes are too annoying, just change the
keyboard mapping.

I'm suprised you didn't mention the situation where trigraphs were
commonly
used on macs, namely with 32-bit character constants like '???\?'.

--
Peter

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: trigraphs, yecch Keith Thompson C Programming 20 02-07-2012 10:40 AM
Re: trigraphs, yecch Ben Bacarisse C Programming 9 02-01-2012 01:27 PM
Re: trigraphs, yecch Peter Nilsson C Programming 7 02-01-2012 12:15 PM
Trigraphs & entry Vijay Kumar R Zanvar C Programming 14 11-05-2003 11:22 PM
Trigraphs Christopher Benson-Manica C Programming 33 09-18-2003 12:39 AM



Advertisments