|
On Tue, 6 Feb 2001, Douglas Handy wrote: > Mark, > > > OK, pop quiz: What are the values (under debug) of P1x through P5x? > > The same pointers will exist on the stack, and since you defined them the same > in TEST2, you'll "see" the same values as TEST1 did. Had you defined P1x > through P5x as different data types/lengths, what you'd "see" would be based >on > the same starting address of the XTEST program variables. For example, if you > defined P1x as 5 long, it would "see" it as 'ABCDE' and if you defined P4x as >5 > long it would "see" it as 'xyz12'. If you defined one as a packed decimal > number, you'd get a decimal data error if you referenced it. If you defined >P1x > as a 5-digit interger (5I 0), then P1x would equal 49602 (=x'C1C2'). > > > Why the surprise? I expected the program to either bomb (no parms were > >passed to XTEST2) > > Since the CLLE program XTEST did not prototype the call to TEST2, there is no > parameter checking -- just like in OPM. > > Think for a minute what you'd expect if all the programs OPM. Would you still > be surprised? That is in essence what you have here since you don't have > prototypes on both sides to validate parameter definitions. > To be honest with you, this surprised me as well. He really should be getting "pointer not set for location referenced" or similar message when XTEST2 is first called. It seems to me that the addresses of the parameters should be *NULL if they weren't ever SET by passing parms to the procedure. The fact that they happened to point to the same area of memory that the previous procedure pointed to seems like an extraordinary coincidence! This implies that when the module is loaded into memory that it's not initializing its variables to NULL, as I believe that it should. I'd be interested in what Barbara & Hans have to say. +--- | This is the Midrange System Mailing List! | To submit a new message, send your mail to MIDRANGE-L@midrange.com. | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com. | To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
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.