C pointer problems in VMS.

Mike Ayers V053MF43 at ubvmsc.cc.buffalo.EDU
Fri Mar 18 00:29:20 AEST 1988



    I have recently been having some big problems passing pointers in VMS C. 
Consider the following:

char *wr(a)
int a;
{ body }

main()
{
 printf(" %s ",wr(4));
}

    This compiles and links without any problems, but I get a stack dump when 
I run it. The same is true of the following:

main()
{
 char b[12];

 b[0]='A';
 strcpy(((&b)+1),"rf!");
 printf(" %s ",b);
}

    Once again it compiles and links without warning, but dumps the stack upon 
execution. I checked my trusty K&R (less trusty by the day, it seems), which 
said that this should be correct.
    I am working in VMS 4.7 . Under this version we must link to 
SYS$SHARE:VAXCRTL.EXE/SHARE instead of the default library. Has anyone else 
had this problem, and if so, what can be done about it? At present I am living 
in fear of library calls that I thought were legal.



   Me again . . .             Mike Ayers                 /|___/|
                                                        / ,  _ |
   INTERNET: V053MF43 at UBVMS.BITNET or                   | O O  /
             V053MF43 at UBVMS.CC.BUFFALO.EDU              /    /
   SNAILNET: 190 Minnesota Ave.                        |\  /      ARF!
             Buffalo, NY 14214                          ---
   BELLNET : (716)838-3696                               U

   DISCLAIMER: I _AM_ the infinite number of monkeys.



More information about the Comp.lang.c mailing list