C macros
Frank Kolmann <[email protected]>
| Newsgroups | gmane.comp.lang.as400.c |
|---|---|
| Message-ID | <CAB-SQvimimgyEksNDimtgrVSAb6s=0OvVCvK_vWP7WTPu34HAQ@mail.gmail.com> |
Hi Barbara
Thank you for your comments. I am happy to start a discussion on macros.
Please understand I value and appreciate your comments.
Couple of points.
I found the 'forever' macro in this book. pp97
The C programming Language
By Brian W. Kernighan and Dennis M. Ritchie.
Published by Prentice-Hall in 1988
ISBN 0-13-110362-8 (paperback)
ISBN 0-13-110370-9
-- exerpt --
Any name may be defined with any replacement text. For
example
#define forever for (;;) /* infinite loop */
defines a new word, forever, for an infinite loop.
Do you mean to say that the C gods K&R themselves published weird code?
Also if C programmers cannot cope with macros does not that imply they
are not truly C programmers.
Why does C have the ability to have such marco substitution if it is
not to be used.
Particularly if it helps avoid a potential bug that the compiler
does not report and only manifests at execution time (= for ==).
I believe I will have no problem interpreting the standard C
code or other C code with macros.
Frank
>*Subject: Re: First C Program
> *From: Barbara Morris <bmorris@xxxxxxxxxx>
> *Date: Thu, 03 Apr 2014 13:42:13 -0400
>
>Hi Frank, I have been thinking about the use of macros such as
>EQ, forever, NE etc, and I think you are doing yourself a disservice
>by using these macros as a beginner C programmer. Here are some of the
reasons:
>
>You will find it less easy to read "normal" C code if you don't get
>used to seeing *and quickly interpreting* things like != == for(;;)
>
>You will find it more difficult to incorporate code that you find on the
web.
>You will have to either change all the == and != to use your macros,
>or perhaps even worse, you will have a mixture of EQ and ==.
>
>You will not be able to post snippets of code to forums without
>replacing your macros. I wouldn't post weird code like that to any forum
>even with an explanation for what the macros mean.
>The discussion would almost certainly be more about the use of the macros
>than about whatever question you were trying to ask.
--
This is the Bare Metal Programming IBM i (AS/400 and iSeries) (C400-L) mailing list
To post a message email: C400-L-Zwy7GipZuJhWk0Htik3J/[email protected]
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/c400-l
or email: C400-L-request-Zwy7GipZuJhWk0Htik3J/[email protected]
Before posting, please take a moment to review the archives
at http://archive.midrange.com/c400-l.