> And the library can't define the function TheFunc?
Of course it can. It does not for pedagogical reasons. Without wishing to sound offensive, I would have thought that was obvious.
> I'm not convinced.
> In the article you specifically speak of different builds:
> "These five lines [...] select the appropriate version of TheFunc based on whether the current build settings are specifying a single-threaded, or a multi- threaded, compilation."
> I would expect that there were two versions (builds) of the lib. One version that contains the TheFuncMT (the multi-threaded version) and another version that doesn't. In fact, that is how it is usually done. I see no reason why both of the libraries couldn't also contain the TheFunc, which would call the appropriate function (either TheFuncST or TheFuncMT) "as a convenience to the user".
Of course. In the vast majority of cases one does exactly that. But not in all
cases; I have myself, on rare occasions, written binary libs which provide single and mult-threaded versions of a component, which are implemented internally as different instantiations of a template. Hence, your implied criticism of the pure, and therefore fatuous, pedagogy doesn't hold, at least not IMO.
> I agree that one shouldn't use macros for the purpose described in the article.
> It is almost never necessary even in C.
> Furthermore, the use of inline functions would also be possible in C99.
Good point. We considered whether to include this, but it got lost in the wash, and the desire for brevity. That was probably a mistake, and I expect we'll find a point to add this in.
> However, the article, like categorically almost all articles and books dealing with or mentioning (C preprocessor) macros take a very simplistic attitude saying essentially that "macros are Bad, because authority X says so".
Well, maybe that's how you read it, but I don't think it gives that message. I think the section "Can good C-itizens still get caught?" counters your assertion.
> It is no wonder we see really silly uses of macros. None of the people who know better are thoroughly explaining why macros may be bad and how one might define well behaving macros. When people invariably end up using a macro for some purpose the result is a disaster.
This is the second time you've stipulated we should "know better" (http://www.artima.com/forums/flat.jsp?forum=226&thread=73370
Anyway, I disagree completely with this completely. The article ably demonstrates how the use of TheFunc macro is bad. How could its effects be called "good"??
> In my opinion, this article is a "start", but it stops very short---too short.
Then front up and write the rest of the picture. I have no doubt that Chuck would love to have a submission from you, and I'm always interested in learning more.