This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

C pointer variables error #513

Hi,
I have a problem with the uVision IDE for programming Atmel ARM-based microcontrollers.
This is the code:

main()
{
  int *pa;

  pa = 0x200000;
  *pa = 0xFFFF;
}


Very simple... On Windows C compiler this code will not be any problem, apart from the fact that application will crash because the memory location specified is not accessible.
On uVision, instead, the compiler reports this error message:

main.c(6): error:  #513: a value of type "int" cannot be assigned to an entity of type "int *"


Thank you in advance,
Luca

Parents
  • I seriously doubt that a Windows C compiler will not spit out an error.

    A somewhat typical C compiler would not treat this as an error --- but most would be prepared to issue a warning.

    A C++ compiler, OTOH, must treat this as an error, because the language definition says so.

    Lesson to be taken home from this exercise: many books, and even more people claim that C were just a simple sub-set of C++. They're all wrong.

Reply
  • I seriously doubt that a Windows C compiler will not spit out an error.

    A somewhat typical C compiler would not treat this as an error --- but most would be prepared to issue a warning.

    A C++ compiler, OTOH, must treat this as an error, because the language definition says so.

    Lesson to be taken home from this exercise: many books, and even more people claim that C were just a simple sub-set of C++. They're all wrong.

Children