I have no idea how a particular C compiler would behave but I think the problem is that any time you do anything resembling
void *foo; int bar = (int)foo; then what you get is what you get. We all know that a 32-bit address and a 32-bit integer are the same thing to the z architecture, but to the C compiler they are distinct, and the conversion from one to the other is whatever the C compiler makes it. My Kernighan & Ritchie says (A6.6) "a pointer may be converted to an integral type ... the mapping function is ... implementation dependent." ----------------------------------------- I wonder, what if the OP reversed the casting and instead coded if ( ptr == (void *)0xff000000 ) ... Is that legal? (Can you cast a constant to a void* ? My MS VS C++ just let me do it.) Would that work? Charles -----Original Message----- From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf Of David Crayford Sent: Thursday, March 27, 2014 3:56 PM To: [email protected] Subject: Re: Compiler error in z/OS C compiler I wonder if C99 intptr_t and uintptr_t would solve the problem. ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
