Search code examples
ccompiler-constructionoperatorshistoryalgol

What _did_ the C operators /\ and \/ do?


Anyone can "declare" ones own operators in C.... that is if one is a C compiler guru and has the source code to the C compiler! ;-)

Further questions to puzzle:

  1. How are these operations done in C99? gcc? ...
  2. And why were /\ & \/ dropped?
  3. Which types were the /\ and \/ operators valid for?

Googling for "/\ \/" naturally returns nothing. Wikipedia has a page for neither /\ nor \/. But I have spotted form similar operators are built into the XML character entities!


Source added: I found the offending example in the PDP's cc source file "c00.c":

/*
 * Return the next symbol from the input.
 * peeksym is a pushed-back symbol, peekc is a pushed-back
 * character (after peeksym).
 * mosflg means that the next symbol, if an identifier,
 * is a member of structure or a structure tag or an enum tag
 */
symbol()
{
...
 case BSLASH:
  if (subseq('/', 0, 1))
   return(MAX);
  goto unkn;

 case DIVIDE:
  if (subseq('\\', 0, 1))
   return(MIN);
  if (subseq('*',1,0))
   return(DIVIDE);
...
}


Actual Implementations: The /\ and \/ operators date back as far as Sixth Edition Unix 1975 (so far). Examples: Unix V6(1975), Unix V7(1979) and more currently BSD 2.11(1992-2008)


Solution

  • \/ looks like sup and /\ looks like inf. They could also be and , respectively.

    I don't remember ever seeing these in K&R 2nd edition or any other C book.