Re: First C program

Aaron Albertson <albertaa-r/[email protected]>
Newsgroups gmane.comp.lang.as400.c
Message-ID <OFCC368EE2.A34ED18C-ON85257CAF.0057FDEE-86257CAF.0058645E@us.ibm.com>
The GENCSRC facility allows you to generate C/C++ header files for database
files.  That is the mechanism used in the C++ language.  You can find a
comparison between #pragma mapinc and GENCSRC in Appendix A of the ILE C/C+
+ Programmer's Guide.  Here is a link to the 6.1 version of that document:
http://pic.dhe.ibm.com/infocenter/iseries/v6r1m0/topic/rzaha/sc092712.pdf

Aaron


c400-l-bounces-Zwy7GipZuJhWk0Htik3J/[email protected] wrote on 04/03/2014 10:39:56 AM:

> From: Steve Richter <[email protected]>
> To: "Bare Metal Programming IBM i (AS/400 and iSeries)" <c400-
> [email protected]>,
> Date: 04/03/2014 10:40 AM
> Subject: Re: [C400-L] First C program
> Sent by: c400-l-bounces-Zwy7GipZuJhWk0Htik3J/[email protected]
>
> I notice that C++ does not support the #pragma mapinc statement:
>
> #pragma mapinc("ddhpf","*libl/REL(*ALL)","input"," ",,"")
> #include "ddhpf"
>
> I was going to suggest compiling as C++ and using classes to reduce the
> complexity of the code. But the CRTCPPMOD command does not support
#pragma
> mapinc ?
>
> "QGPL/QRPGLESRC(CSAMPLEC)", line 22.10: CZP0836(30) The #include file
>   "ddhpf" is not found.
>
> -Steve
>
>
>
> On Thu, Apr 3, 2014 at 6:39 AM, Frank Kolmann <[email protected]> wrote:
>
> > Hi Jevgeni
> >
> >
> >
> > Thank you.  You make good points.
> >
> > That is a good way of trapping the == issue.
> >
> > I will follow Barbaras advice in the coding of the if.
> >
> >
> >
> > I like the way you use the #define for the type defs.
> >
> > It does make the code clearer, I will use that sytle.
> >
> >
> >
> > Frank
> >
> >
> >
> >
> >
> > >*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 =/==
possible
> > mistake.
> >
> > >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
your
> > program.
> >
> > > My personal practice is to use "explicit" way of defining types. For
> > example:
> >
> > >
> >
> > >#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....
> > --
> > 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.
> >
> >
> --
> 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.
>
-- 
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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.