On Wed, 26 Apr 2017 11:09:19 -0500, Elardus Engelbrecht (elardus.engelbre...@sita.co.za) wrote about "Re: Can XLC printf() take "%D(*,*)"?" (in <7516686188585950.wa.elardus.engelbrechtsita.co...@listserv.ua.edu>):
> David W Noon wrote: > >> You should not be passing a pointer (&x); everything is passed by value. > > Not many programmers are getting that right. Just that is making debugging > extremely painfully difficult. It's part of the C/C++ learning curve, I'm afraid. > I am just curious - Are there any compiler option(s) to help you to avoid > that specific error? Not that I know of. A lot of such problems went away when the old K&R dialect of C became deprecated. The C89 standard required functions to be specified by a prototype that defined the exact type of each parameter, and the compiler would match the type of the actual parameter to the type specified for the formal parameter. The problem really arises with "vararg" functions like printf() & co. These accept any argument in the second and subsequent parameter position(s), thus disabling the compiler's type matching. This is a major reason why I prefer C++ file streams to C's library routines for I/O. -- 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