What are digraphs in C?

Asked

Viewed 179 times

6

Based on the question of graphs, what are digraphs?

  • Why were they created?
  • What are the sequences?
  • Current compilers still allow you to use them?

1 answer

6


I wish you hadn’t asked :P

The early days of computers had difficulties entering certain types of characters, so these sequences of characters were created to represent another one that really should have been "typed" there. Something similar to what is done with Unicode nowadays in certain situations where it is not possible to easily enter the character.

According to the Wikipedia would be these sequences:

<:  ->  [
:>  ->  ]
<%  ->  {
%>  ->  }
%:  ->  #

Graphers

??= -> #
??/ ->  \
??' ->  ^
??( ->  [
??) ->  ]
??! ->  |
??< ->  {
??> ->  }
??- ->  ~

In general compilers allow. O C++ wants to take this out of the specification (I think you already took).

Better not use, there’s no reason for it nowadays. There’s a example here.

  • 4

    The first ones look like emoticons' grandparents :)

  • Add an example @bigown, so I’ll mark it as a response.

  • @Laertes for what? No need :)

  • In this contest the staff surpasses themselves: The International Obfuscated C Code Contest

Browser other questions tagged

You are not signed in. Login or sign up in order to post.