Is it possible to place a macro in a namespace in c++?

前端 未结 5 1038
花落未央
花落未央 2020-12-05 09:55

My application uses another output than the standard output for logging information, which is why I wrote my own Log(), Error(), Panic()

5条回答
  •  北海茫月
    2020-12-05 10:53

    No, the preprocessor doesn't care about namespaces at all. In fact, the preprocessor runs, at least conceptually, before the compiler sees anything.

    For myself, I just do a standard ASSERT macro, and expect that no "sane namespace" has something called ASSERT. Problem solved. Should I require a library that has an ASSERT of its own then I can still decide how to deal with this; however, the only library that I'm currently using with its own "assert" calls it BOOST_ASSERT or something like that...

提交回复
热议问题