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

Bob Eager rde42 at spamcop.net
Thu Dec 17 16:58:28 EST 2009


On Thu, 17 Dec 2009 15:15:37 -0500, JF Mezei wrote:

> Bob Koehler wrote:
> 
>>    Sadly, ANSI changed that some number of years ago.  ANSI now says
>>    that all three of those are the same pointer.
> 
> 
> Interesting. When I moved from VAX-C to DEC-C not that long ago, I was
> forced to change all &mystring to mystring in my programs.
> 
> This is something which I hated doing because to me, &mystring is far
> better.
> 
> 
> 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.

No, to me it implies that a pointer to 'mystring' (which is itself an 
address, of the base of the array), is being passed.

> if you have status = myroutine(mypointer, mystring); then it is ness
> obvious and you would have to refer back to the definition of each
> variable to make sure. (replace the variable name with "a" and "b" and
> it really ins't obvious which one contans a pointer as value and which
> one contians a string as value.

I agree. And that is why I always use the third form, &mystring[0], which 
makes it even clearer.

Perhaps it's because I am used to using a predecessor of C, where 
'mystring' would be the name of an actual storage cell, that cell 
containing the address of the base of the array....!
-- 
Use the BIG mirror service in the UK:
 http://www.mirrorservice.org




More information about the Info-vax mailing list