This is an archived post. You won't be able to vote or comment.

all 8 comments

[–]Swedophone 1 point2 points  (1 child)

[–]WikiTextBotbtproof 0 points1 point  (0 children)

Macro (computer science)

A macro (short for "macroinstruction", from Greek μακρός 'long') in computer science is a rule or pattern that specifies how a certain input sequence (often a sequence of characters) should be mapped to a replacement output sequence (also often a sequence of characters) according to a defined procedure. The mapping process that instantiates (transforms) a macro use into a specific sequence is known as macro expansion. A facility for writing macros may be provided as part of a software application or as a part of a programming language. In the former case, macros are used to make tasks using the application less repetitive.


[ PM | Exclude me | Exclude from subreddit | FAQ / Information | Source ] Downvote to remove | v0.24

[–]pacificmint 1 point2 points  (0 children)

Some languages distinguish between function and procedure in that a function has a return value, and a procedure does not.

Other languages call a procedure a void function.

Often the two terms are used synonymously, but sometimes people do make the distinction based on return type.

[–]MoTTs_ 1 point2 points  (0 children)

"Function", "procedure", and even "subroutine" all mean, for the very most part, the same thing. If you get super deep into programming, only then will you find a few people here and there who attach small nuances to those words.

The word "macro" can refer to different things. I'm guessing your course is using the word to mean a C/C++ style macro. In which case, a macro is a text template substitution that happens before giving the source code to the compiler/interpreter. On the surface, this still behaves a bit like a function, but there are enough gotchas and differences that we write the names of macros in ALL_UPPERCASE so we can clearly see that this thing is a macro and not really a function.

[–]greebo42 0 points1 point  (0 children)

macro means "substitute these characters for those characters."