{"content":{"id":688,"title":"'Build Your Own Lisp' Solutions: 4.8","body":"\u003cp\u003e\u003cb\u003eQ:\u003c/b\u003e What does the preprocessor command \u003ci\u003e#define\u003c/i\u003e do?\u003c/p\u003e\r\n\u003cbr\u003e\r\n\u003cp\u003e\u003cb\u003eA:\u003c/b\u003e It creates a macro, which is to say, it let's you associate a word with an expression. Before compiling your code, the precompiler will replace every instance of that word with that expression. While most macros you see are quite simple, you can do pretty amazing things with them. See \u003ca href=\"https://gcc.gnu.org/onlinedocs/cpp/Macros.html\"\u003ehere\u003c/a\u003e for a detailed reference.\u003c/p\u003e","publication_date":"2019-06-04T00:00:00.000Z","created_at":"2019-05-04T20:21:30.000Z","updated_at":"2019-05-09T21:41:13.000Z","user_id":1,"rating":null},"tags":"\u003ca class=\"changeable-title\" href=\"/q?tag=c\"\u003ec\u003c/a\u003e \u003ca class=\"changeable-title\" href=\"/q?tag=lisp\"\u003elisp\u003c/a\u003e \u003ca class=\"changeable-title\" href=\"/q?tag=build_your_own_lisp\"\u003ebuild_your_own_lisp\u003c/a\u003e \u003ca class=\"changeable-title\" href=\"/q?tag=answers\"\u003eanswers\u003c/a\u003e \u003ca class=\"changeable-title\" href=\"/q?tag=programming\"\u003eprogramming\u003c/a\u003e"}

'Build Your Own Lisp' Solutions: 4.8

Q: What does the preprocessor command #define do?


A: It creates a macro, which is to say, it let's you associate a word with an expression. Before compiling your code, the precompiler will replace every instance of that word with that expression. While most macros you see are quite simple, you can do pretty amazing things with them. See here for a detailed reference.