[libcxx-commits] [PATCH] D94569: [libcxx] Wipe some more macros that do not belong in C++ forwarding headers

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jan 13 08:37:29 PST 2021


ldionne added a comment.

In D94569#2495861 <https://reviews.llvm.org/D94569#2495861>, @mclow.lists wrote:

> The C11 standard states (in section 7.21.7.5 The getc function):
>
> 2 The getc function is equivalent to fgetc, except that if it is implemented as a macro, it may evaluate stream more than once, so the argument should never be an expression with side effects.

Hmm, thanks for the quote. I didn't know it was acknowledged like that.

However, that is C, and I would still claim that an implementation that defines those as macros is C++-unfriendly. I actually don't even know how things work if `getc` is a macro: how is `using ::getc;` ever going to work? If `getc` is a macro, then arguably `::getc` (after undefining the macro) isn't pointing to a valid declaration, unless they decided to provide both a function `::getc` *and then* to define a macro with the same name. In any case, that sounds twisted. Am I missing something?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94569/new/

https://reviews.llvm.org/D94569



More information about the libcxx-commits mailing list