[Info-vax] Dave Cutler, Prism, DEC, Microsoft, etc.

Bob Koehler koehler at eisner.nospam.encompasserve.org
Thu Dec 17 16:24:11 EST 2009


In article <00d8a4c7$0$27961$c3e8da3 at news.astraweb.com>, JF Mezei <jfmezei.spamnot at vaxination.ca> writes:
> 
> conside this:
> 
> char *mypointer, mystring[256] ;
> 
> 
> status = myroutine(mypointer, &mystring) ;
> 
> You could clearly know that the value of mypointer is being passed,
> while it is clear that a pointer to mystring is being passed.
> 

   Consider this:

   char *a, *b, c[192];

   b = c;

   status = myroutine1(a, &b);

   status = myroutine2(a, &c);

In the assignment statement, both "b" and "c" are of type "char *".  Now 
for the second argument of myroutine1, I've passed a pointer to a pointer
to c[0].  But for the second argument of myroutine2, I've passed only the 
pointer.

   As the programmer, I know c is an array, and that an array name with one
   or more missing indexes is the address of that slice.  So following
   logic, which computers are known to do, the second argument to
   myroutine2 should be a pointer to a pointer.

<voice of Billy Mays>

  But WAIT!  It isn't.

</voice of Billy Mays>

   It's an exception to a rule.  C already has enough of those.  And what
   if you wanted a pointer to a pointer to c[0]?  You don't get one by
   simply using the most obvious syntax.




More information about the Info-vax mailing list