AnsweredAssumed Answered

strcpy volatile char * not accepted as argument

Question asked by dfrisch on Dec 8, 2011
Latest reply on Dec 15, 2011 by dfrisch

Hello, My name is Dustin and I am currently attending the University of Calgary and taking ENCM511 with Dr. Mike Smith.

 

I have found what appears to be a bug in the VisualDSP++ compiler I figured

I should post this in case this was not the expected operation of the compiler,

otherwise it should help someone else who has the problem in the future

////////////////////////////////////////////////////////////////////////////////

Here is the code to show the problem:

////////////////////////////////////////////////////////////////////////////////

#include <string.h>

 

volatile char thing[42];

 

void main(void) {
    strcpy(thing, "This should compile - ENCM511 rules");
    strcpy( (char *) thing, "This does compile - ENCM511 rules");
}

 

////////////////////////////////////////////////////////////////////////////////

Here is the output from the build window:

////////////////////////////////////////////////////////////////////////////////

 

.\Lab4Tests_main.cpp
".\Lab4Tests_main.cpp", line 6: cc0167:  error: argument of type
          "volatile char *" is incompatible with parameter of type "char *"
  strcpy(thing, "This should compile -- ENCM511 rules");
         ^

 

1 error detected in the compilation of ".\Lab4Tests_main.cpp".
cc3089: fatal error: Compilation failed
Tool failed with exit/exception code: 1.
Build was unsuccessful.

Outcomes