If by "C's less powerful macro language", you actually mean abysmal 
pre-processor language then I totally agree. C programmers will use motivated 
reasoning to convince you that C is still the language of choice. The problem 
is that C hasn't really grown as a language to help programmers (C purists 
don't consider C++ true C because of it's runtime overhead). In the last 50 
years, standards (e.g. K&R, posix, ansi, C89, C90, ...) mostly added functions. 
C programmers love to add functions and this is the problem. 
As an example consider C's 14 absolute value functions. They still haven't 
implemented function overload which would allow programmers to code the same 
function name for all data types. C++ could easily change these to a single 
function call but still require the programmer to make the correct choice. In 
HLASM, a macro could easily choose the correct function based on the data 
types. Imagine converting OPEN / DCB to C functions. Even IBM's fopen 
implementation is unusual in that it contains keyword arguments.
Both C and HLASM could learn from each other. If C implemented a macro language 
and function overloading, then it would be an exceptional language. HLASM on 
the other hand needs macro's that return values and allow stacking macro calls 
on a single source statement.
Rarely will C programmers code more than basic C macro's. I wish that C 
programmers thought integration / usability rather than C function 
implementation.
 I'm confused by why you say assembler macro language is not suitable for C. It 
would make C great. Byte or char are the only data types with a known length. 
All others must be a minimum size but is not guaranteed to be that length. The 
C "sizeof" allows my program to access the size of any variable. Macro "if" 
statements don't understand "sizeof" so they cannot choose the proper function 
for the size (e.g. absolute value).
 At this time, High Level ASM is far more programmer friendly than C. In z 
systems, HLASM macro language more than makes up for what I lose by not using C.
    Regards, Jon.

 On Saturday, December 9, 2017 5:58 PM, Charles Mills <[email protected]> wrote: 
C-type macros are both good and bad. They are less powerful than assembler
macros with their .labels and looping and so forth, but OTOH they
incorporate the idea of both assembler macros and assembler SET symbols in a
single construct. C is really a very different sort of language from
assembler: whereas assembler is line oriented, C is mostly character-stream
oriented. Assembler type macros would not exactly make sense. 

On Behalf Of Phil Smith
(Of course, so-called "high-level" languages like C should be so lucky as to
have the power of assembler macros! Their idea of a "macro" is really quite
primitive.)


   

Reply via email to