#define UP_PP_COMPARE_0(x) x #define UP_PP_COMPARE_1(x) x #define UP_PP_COMPARE_2(x) x #define UP_PP_COMPARE_2(x) x #define UP_PP_COMPARE_3(x) x #define UP_PP_COMPARE_4(x) x #define UP_PP_COMPARE_5(x) x #define UP_PP_COMPARE_6(x) x #define UP_PP_COMPARE_7(x) x #define UP_PP_COMPARE_8(x) x #define UP_PP_COMPARE_9(x) x #define UP_PP_COMPARE_10(x) x #define UP_PP_COMPARE_11(x) x #define UP_PP_COMPARE_12(x) x #define UP_PP_COMPARE_12(x) x #define UP_PP_COMPARE_13(x) x #define UP_PP_COMPARE_14(x) x #define UP_PP_COMPARE_15(x) x #define UP_PP_COMPARE_16(x) x #define UP_PP_COMPARE_17(x) x #define UP_PP_COMPARE_18(x) x #define UP_PP_COMPARE_19(x) x #define UP_PP_COMPARE_20(x) x #define UP_PP_COMPARE_21(x) x #define UP_PP_COMPARE_22(x) x #define UP_PP_COMPARE_22(x) x #define UP_PP_COMPARE_23(x) x #define UP_PP_COMPARE_24(x) x #define UP_PP_COMPARE_25(x) x #define UP_PP_COMPARE_26(x) x #define UP_PP_COMPARE_27(x) x #define UP_PP_COMPARE_28(x) x #define UP_PP_COMPARE_29(x) x #define UP_PP_COMPARE_30(x) x #define UP_PP_COMPARE_31(x) x #define UP_PP_COMPARE_32(x) x #define UP_PP_IS_COMPARABLE(x) UP_PP_IS_TUPLE(UP_PP_CAT(UP_PP_COMPARE_, x)(()))
>>4 It is used for all sorts of things. For example, I'm targetting some old compilers for some obscure platforms, and I don't have always have access to C++11 features. No problem. // In void.h:
Agreed. Back in early 90ies, everything was written in MASM and TASM, because C/C++ is just too slow for 1MHz 16bit CPU, with too little memory to facilitate far jumps, required by C/C++.
>>16 8086 compilers in the 80s and early 90s also sucked. The Watcom compiler (and MSVC as well, I believe) actually generates pretty good code and can handle mixed near/far calls in the same program.
Name:
Anonymous2014-04-05 17:04
Those aren't even macros, just the lame C nuisance misnomer.
Name:
Anonymous2014-04-05 17:48
>>18 Misnomer? That implies the existence of an earlier use of the word `macro' for programming that C's notion contradicts. But from what I can tell, the earliest origin of the term `macro' comes from assembly macros: for example the [i]705 Autocoder System Macro-Instruction Manual[/i], of which a copy is retained at https://archive.org/details/bitsavers_ibm7053274Instrs1957_6769339 .
Macro-Instructions are easily written commands to the Autocoder which cause it to create sequences of machine instructions to carry out certain commonly used functions. A typical macro-instruction consists of a single line entry writen by the programmer in the same format as a 705 instruction. It will automatically cause the generation of from one to more than a dozen 705 instructions and may also call in desired subroutines of hundreds of instructions.
Browsing through the examples, they seem very similar to C preprocessor macros - a single line is typed, with a few operands, and from what I can determine the Autocoder system fully replaced the line of that macro with other lines, with the operands substituded in at regular intervals. Am I missing something?
Name:
Anonymous2014-04-06 8:19
>>19 If you want real macros, learn Lisp. All other "macros" are decoys, misnomers, nuisances, pieces of shit.
gas' macro syntax is rather limited, but you can pair it with m4. Oddly enough it's also popular to just write a Perl script that prints gas code when evaluated...
Name:
Anonymous2014-04-10 4:41
>>26 Why not just use C? If you use a lot of macros. A C-compiler can optimize your code, but assembler just outputs whatever the shit your macro commands it to output (which is probably slower.)
>>27 Of course, if you are using assembler it's a good idea to know why first.
Name:
Anonymous2014-04-10 9:27
Of course, if you are penetrating an anus it's a good idea to know why first.
Name:
Anonymous2014-04-12 1:34
>>25 I remember seeing a Fasm macro `program' that compiled to a bitmap of the an image Mandelbrot set of the given dimensions and level of detail, but I can't find it, despite searching those forums back until 2005, when I think I saw it. I recall it was only about 50 lines, but they were called recursively, so it took several minutes to be assembled. Does anyone have it?
Name:
Anonymous2014-04-12 7:02
>>27 Because C doesn't have macros. Only Lisp has them.
>>31 If ``only'' Lisp has macros, and Lisp's use of the term ``macro'' isn't even the first, wouldn't it make sense to just use another term for Lisp's macros? That way you don't have to get butthurt when people talk about macros without mentioning Lisp.
Name:
Anonymous2014-04-12 9:21
>>32 Lisp macros are the first real macros. Meanings of words change, so the word macro should only refer to Lisp macros, not to the primitive unhygienic text substitution. Use "text preprocessing" instead of "C macros".
>>33 No, that would be stupid. How about we call the things Lisp has ``Lisp macros'' because they are (according to you) so unique, and we'll call everything else just plain ``macros''.
Oh, would you look at that. We already do. So stop whining and bringing up irrelevant concepts.