-5

Does anyone know (or can guess) the rationale for:

  • #define over #def
  • #undef over #undefine

Reason:

  • expected: symmetry: #define or #def, and #undefine or #undef => easy to remember
  • actual: no symmetry: #define and #undef => not easy to remember
Barmar
  • 741,623
  • 53
  • 500
  • 612
pmor
  • 5,392
  • 4
  • 17
  • 36
  • 3
    These are just arbitrary choices made by the original language designer, fitting their personal esthetics. You could just as easily as "why `int` rather than `integer`?" – Barmar Dec 30 '21 at 15:35
  • 1
    why `unsigned` instead of `uns` – 0___________ Dec 30 '21 at 15:37
  • 1
    One thing to remember is that in the 1970's memory and disk space were not cheap. So language designers had to compromise between readability and terseness. – Barmar Dec 30 '21 at 15:38
  • 1
    That's why `mv` and `cp` rather than `move` (or `rename`) and `copy`. – Barmar Dec 30 '21 at 15:39
  • 1
    @Barmar, don't forget about `dd` that stays for "copy and convert". – tstanisl Dec 30 '21 at 15:47
  • 1
    Successful languages (human as well as computer) are rarely perfectly regular or symmetrical. – Steve Summit Dec 30 '21 at 16:18
  • @tstanisl `dd` is the most accurate of the names if you associate it with "Disk Destroyer" :) – David Ranieri Dec 30 '21 at 21:15
  • 1
    @pmor: Not an answer, but a good datapoint. [Six characters](https://stackoverflow.com/a/38042724/1566221) – rici Jan 06 '22 at 03:56
  • @rici Thanks. Maybe [relevant](https://stackoverflow.com/questions/66336788/does-name-of-stdatomic-h-contradict-with-potential-restriction-of-the-mapping). – pmor Jan 10 '22 at 21:08
  • @SteveSummit In some human languages a negation may change [grammatical case](https://en.wikipedia.org/wiki/Grammatical_case), which I totally unexpect. – pmor Jan 10 '22 at 21:13

1 Answers1

2

not easy to remember

Very easy - just two keywords.

Does anyone know (or can guess) the rationale for:

I believe there was no rationale behind it (except many laziness #undefine 9 char long) - the best person to ask is Alan Snyder who introduced the preprocessor to C language. But probably he does not have the logical answer to this question.

0___________
  • 60,014
  • 4
  • 34
  • 74