A C++ question,
I know
int* foo(void)
foo will return a pointer to int type
how about
int &foo(void)
From Alfred's comments
This is what the document says, Texas instrument's TMS320C28x C/C++ compiler intrinsics, page 122, int&__byte(int, unsigned int), I guess it is different from PC – Alfred Zhong
From the manual:
int &__byte(int *array, unsigned int byte_index);
MOVB array[byte_index].LSB, src
The lowest adressable unit in C28x is 16 bits. Therefore, normally you cannot access 8-bit MOVB dst, array[byte_index]. LSB entities off a memory location. This intrinsic helps access an 8-bit quantity off a memory location, and can be invoked as follows:
__byte(array,5) = 10;
b = __byte(array,20);
This just means that the function returns a reference to an integer that acts like an 8 bit quantity. Because the value is a reference modifying will modify the object at the destination (just like the MOVB) instruction, while assigning to b will copy (just like MOVB) to the destination.