Sydius Sydius - 28 days ago 6
C Question

Why are there digraphs in C and C++?

I learned today that there are digraphs in C99 and C++. The following is a valid program:

%:include <stdio.h>

%:ifndef BUFSIZE
%:define BUFSIZE 512
%:endif

void copy(char d<::>, const char s<::>, int len)
<%
while (len-- >= 0)
<%
d<:len:> = s<:len:>;
%>
%>


My question is: why do they exist?

CTT CTT
Answer

Digraphs were created for programmers that didn't have a keyboard which supported the ISO 646 character set.

http://en.wikipedia.org/wiki/C_trigraph