|
*Subject: Re: First C program
*From: Jevgeni Astanovski <Jevgeni.Astanovski@xxxxxxxxxxxxx>
*Date: Wed, 2 Apr 2014 07:54:34 +0000
Yes. Barbara mentioned the define and I haven't...
Definitely there are lots of this sort of advises to avoid =/== possiblemistake.
I've never saw the one you referred.
However some use another technique:
Instead of writing
if ((pf = _Ropen(PFILENAME, "rr")) == NULL)
they write
if (NULL == (pf = _Ropen(PFILENAME, "rr")))
In this case if you make a mistake and write
if (NULL = (pf = _Ropen(PFILENAME, "rr")))
you will immediately get a syntax error.
On the second issue - this is purely a question of how readable is yourprogram.
My personal practice is to use "explicit" way of defining types. Forexample:
#pragma mapinc("dspf", "*LIBL/Y80ALD(ADDCHRG)", "both", "_P", "Y80", "Y80")
#include "dspf"
#define INPUT_T Y80_ADDCHRG_i_t
#define OUTPUT_T Y80_ADDCHRG_o_t
in this case it is (more) clear where these types are derived from....
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 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.