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

Difference between two pointers

I'm using the ARM Realview compiler with a Cortex-M3 device. I would like to caclculate the difference/distance between two pointers:

char* IndexStart, IndexStop;

// Search for the beginning of the domain name
IndexStart = strchr(((char*)(ÐRxBuffer[0])), ' ');
// Search for the end of the domain name
IndexStart = strchr(++IndexStart, '\r');
// Copy the domain name
(void)strncpy((char*)SMTPDomainName, IndexStart, (IndexStop - IndexStart));

But I get an error message: error: #32: expression must have arithmetic type when subtracting the pointer and using the result as an integer type.

According to the ARM documentation this is not allowed by the ISO C standard. I've disabled strict mode by setting --no_strict even though --no_strict is the default compiler setting but it still gives me this error.

How can I work around this?

0