C++ – 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

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

My question is: why do they exist?

Best Solution

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