Hi Jevgeni

Thank you for the information. No I am not joking.
Did not K&R design C? Why have macros in C at all?
(I am sure there are real reasons, just my knowledge is so limited)
I am still trying to come to grips with macros in general.
When I first saw C macros my immediate impression was
'who can devise a macro that will reliably do what is intended in all
cases?'
(and I still have same impression)
(it is almost like having a unreliable compiler within a compiler)
You, Barbara, Marc and others all warn about deviating from 'c style'
including program structure and use of macros.
To me I believe your warnings say more than you realise.
eg the ++ operator, initially I thought it meant ?? = ?? + 1
however the power of ++ operator is way beyond +1, especially for pointers,
Thank you I will take on board all your advices.

So the end conclusion I am reaching is, there are reasons why C++ Java C#
AWK
et al compilers were designed and to accept C with all its warts and
progress to
newer compilers (as I am) and hopefully the programmer world will evolve to
a brighter future.

Also thanks Marc for the link to macro discussions. (just reinforced my
prejudices)

Frank

Subject: Re: C macros
From: Jevgeni Astanovski
Date: Fri, 4 Apr 2014 09:37:48 +0000 List-archive:

Frank, I think that your reference to K&R is a joke.
K&R book is a book for learning language. It is not for learning style.
They used "forever" as an example what CAN BE done using #define
but they never said that it SHOULD BE done. Feel the difference.
I personally hate this sort of macros because they make program unreadable
for others -
exactly what Barbara told you earlier.
So: think of the people who will read your code, use clear constructions
....

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2026 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.