<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Il 25/02/2018 13:55, Florian Klämpfl ha scritto:<br>
</p>
<blockquote type="cite"
cite="mid:803a15de-5a6f-ca6a-535b-bcf7ec8d84dc@freepascal.org">
<blockquote type="cite" style="color: #000000;">
<pre wrap="">To limit their use.
</pre>
</blockquote>
</blockquote>
<br>
Well, just for sake of argument, it appears to me a rather drastic
approach.<br>
<br>
You may write other similar pages on stackoverflow, telling why
Dereferencing is evil, Typecasting is evil, or why "Absolute" or the
"with" construct are evil. All of them, if misused, can lead to
unexpected results, with code hard to read, easy to misinterpret,
and hard to debug. Nonetheless they're part of the language, and,
properly used, are useful programmer's tools.<br>
<br>
Most of the drawbacks of macro arguments can be easily overcome if<br>
a) The listing of preprocessor output is generated.<br>
b) The preprocessor output is provided to the debugger as the actual
program source<br>
None of the two should require a titanic effort!<br>
<br>
IMHO macro arguments, if properly used, may be a valid additional
programmer tool.<br>
<br>
E.g. Converting a C program to Pascal I had:<br>
C code:<br>
<br>
<pre>#define EXCH_INITIALIZER(nam) \
{NULL,NULL,NULL,NULL,NULL,PTHREAD_MUTEX_INITIALIZER,nam}
....
EXCHANGE_DESCRIPTOR cp_ready_ex = EXCH_INITIALIZER("CP_RDY");</pre>
<br>
Lacking macro arguments, the equivalent declaration in fpc became:<br>
<pre>cp_ready_ex: exchange_descriptor = (
message_head : Nil;
message_tail : Nil;
task_head : Nil;
task_tail : Nil;
exchange_link : Nil;
mutex : (__m_reserved: 0; __m_count: 0; __m_owner: Nil;__m_kind: 0;__m_lock: (__status: 0;__spinlock:0));
name: ' CP_RDY';);</pre>
(and I had quite a number of them!)<br>
A lot of error prone typing, just to provide the only useful
information, i.e. the readable name of the thing.<br>
<br>
Giuliano<br>
</body>
</html>