On Wed, 26 Apr 2017 10:01:06 -0700, Charles Mills (charl...@mcn.org) wrote about "Re: Can XLC printf() take "%D(*,*)"?" (in <0dc501d2beae$b2613e30$1723ba90$@mcn.org>):
> I don't seem to be able to declare a D variable in C++. > > I am coding the parameter to printf() as > > *reinterpret_cast<D(31,0)*>(value) A reinterpret_cast will only result in another pointer, as all it does is change the notional type but keep the bit pattern the same. An array is always a pointer in C/C++, so a char[] is always reduced to its address. > where value is declared as char[1] and contains (variable length, passed to > me as a parameter) the fixed point decimal data. The compiler is giving me > > line 1047.39: CCN5130 (S) "D" is not declared. > > (And yes, I #include <decimal.h> without error.) > > I am starting to think this approach is hopeless (pending what if anything I > hear from Toronto). I think you'll need to use "C thinking" rather than "C++ thinking". My suggestion of using a struct is the best I have come up with so far. > I am currently using an interpretive loop to format the decimal data. I am > going to look into using __EDMK() instead. (And yes, the volume, potentially > millions of iterations per day, justifies the effort.) Do you know the size and scaling factor of the packed decimal values at compile time? If so, the __EDMK() call could be faster than printf(), as those format interpreters [printf(), sprintf(), etc.] often run like treacle in winter. -- Regards, Dave [RLU #314465] *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* david.w.n...@googlemail.com (David W Noon) *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN