<p>I'm wondering about the practical use of #undef in C. I'm working through K&amp;R, and am up to the preprocessor. Most of this was material I (more or less) understood, but something on page 90 (second edition) stuck out at me:</p>

<blockquote>
  <p>Names may be undefined with <code>#undef</code>,
  usually to ensure that a routine is
  really a function, not a macro:</p>
  
  <p><code>#undef getchar</code></p>
  
  <p><code>int getchar(void) { ... }</code></p>
</blockquote>

<p>Is this a common practice to defend against someone <code>#define</code>-ing a macro with the same name as your function? Or is this really more of a sample that wouldn't occur in reality? (EG, no one in his right, wrong nor insane mind should be rewriting <code>getchar()</code>, so it shouldn't come up.) With your own function names, do you feel the need to do this? Does that change if you're developing a library for others to use?</p>

I only use it when a macro in an
```
#included
```
file is interfering with one of my functions (e.g., it has the same name). Then I
```
#undef
```
the macro so I can use my own function.