![]() These are available in most of high level languages but not in C. For example, we can create loops like foreach which are very useful and handy when it comes to arrays. The body of a macroi.e., the part after the macro and optional argumentsis known as the substitution list. The preprocessor treats comments as white space, so comments of the form /* some sort of comment */ are treated as white space. Using C Macros, we can extend C with a lot of useful functionality. C and C++ support two kinds of macros, object-like macros, which have no arguments, and function-like macros, which require arguments. You can do that by using C-style comments ( /**/). This works well for small macros, but if you have a larger macro that is spread over several lines, it might be nice to put comments nearer some tricky or crucial bit of code. The easiest way to document macros is to just add comments before or after the macro definition: // returns the larger of the two arguments The resulting token could be a variable name, class name or any other identifier. ![]() Once youve removed the definition, you can redefine the macro to a different value. For more information, see, Macros and C++. The undef directive removes the definition of a macro. The define directive and The undef directive discuss the define and undef directives, respectively. ![]() Comments are an important part of documenting your code.Īdding comments to macros is quite easy, but it has to be done the right way. The undef directive removes the definition of a macro.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |