pradeexsu
pradeexsu

Reputation: 1145

what '-DLOCAL' flag does in C++ compilation

I want to know what -DLOCAL flag of C++ compilation does ?
which is used as :

g++ -std=c++17 -Wshadow -Wall -o "%e" "%f" -g -fsanitize=address -fsanitize=undefined -D_GLIBCXX_DEBUG -DLOCAL

thanks in advance.

Upvotes: 1

Views: 601

Answers (2)

eerorika
eerorika

Reputation: 238411

The -D command line argument Defines a pre-processor macro. -DLOCAL defines macro LOCAL with value 1. This macro has no special meaning in the C++ language, and no special meaning for the GCC compiler.

Upvotes: 4

pradeexsu
pradeexsu

Reputation: 1145

one use that I found is compiled with -DLOCAL flag allows us to run a statement like cerr, which is for testing

cerr << "some variable for testing";

if we remove -DLOCAL flag in the compilation, cerr will not be showing any output on the console.

this is helpful even we forget to remove all those testing statements it will not affect the program. because we are not compiling with -DLOCAL in general.
thanks

Upvotes: 0

Related Questions