answersLogoWhite

0

#define is a pre-compiler directive which is used to define a macro. All occurrences of the defined macro within your source code are replaced by the macro definition prior to compilation. In other words, your code is altered to produce an intermediate file which is actually compiled, just as if you'd copy/pasted the macro definition throughout your code. However, the end result is that the compiler cannot identify any problems within your macros since they will no longer exist in the intermediate file. Macros are not type safe, thus they are generally frowned upon, especially when they are used to define complex functions. However, correct usage of macros can greatly simplify your code and ultimately permit the compiler to build different versions of your code, depending upon which definitions you define. For instance, you will typically use slightly different versions of some functions depending on whether you are building a debug or release version of your code, and will typically #define DEBUG for debug builds. You can also cater for cross-platform coding by filtering platform-specific functions using macro definitions. You alter the type of the build simply by defining the appropriate definitions, either within the code itself (using #define), or via the compiler's pre-processing command line switches, or a makefile script.

User Avatar

Wiki User

12y ago

What else can I help you with?

Related Questions

In C plus plus what sign do all preprocessor directives start with?

all preprocessor directives start with #(hash) symbol in both c & c++


Why you hash in c language?

ANSWERThe reasons to use hashing in C are the same as in any language. A hash value is used to reduce a value from a complex form into a simpler form, to simplify operations such as searches.


How the turbo c plus plus use in the computer?

How the turbo c plus plus use what in the computer.


How do you use conioh header in c plus plus?

just as you do it in C.


Can you use c plus plus in windosh vista?

Only if you have a C++ compiler.


Which is best C or C plus plus?

depends what you use it for. c++ = object oriented c = not object oriented


User defined data type in c plus plus?

Use "typedef" : both in C and C++.


How do we add the C plus plus category in Netbeans?

To use C++ in Netbeans you will need a C++ compiler.


Can you use c in c plus plus without using class and object?

Sure.


What is the use of c plus plus in banks?

Programming language.


Simple hash table C plus plus code?

The C++11 Standard Template Library (STL) introduced hash table functionality via the unordered associative containers: unordered_set; unordered_multiset; unordered_map and; unordered_multimap. Like their ordered counterparts, the unordered set and multiset store values of a specific type (such that the values form the keys), whereas the map and multimap variants store key/value pairs (std::pair). Both unordered set and map allow no duplicates, whereas the multiset and multimap variants do allow duplicates. If you are still using C++98 or earlier you will need to use non-standard hash table containers such as those provided by the Boost library, which can also be used as alternatives to the C++11 STL versions. Of course, such is the flexibility of C++ that you can also roll your own generic or indeed specific implementations.


Why are there 2 plus sign in c plus plus and Why not a single plus sign?

In C and in C++, the ++ operator means to increment. C++ was intended to be the next version, i.e. the incremental next step, of C, hence the use of the ++ operator.