I use Atmel Studio 7.0 to program a ATSAMC20J18A in C. And I have a compiler warning that I don't understand.
Because I need the quotient and the remainder of a division I want to use the "div" method and the "div_t" struct to perform just one division for both result parts.
I would assume that I use the "div" method in the same way as this tutorial mentioned:
Here the code snippet from my program:
uint32_t iActualStreamClusterNumber = 1234; uint8_t iFatEntrySize = 4; uint16_t iBlockSize = 512; div_t sDivResult = div(iActualStreamClusterNumber * iFatEntrySize, iBlockSize); uint32_t iFATFirstSectorAddress = 12345678; uint32_t iDataSectorToRead = sDivResult.quot * iBlockSize + iFATFirstSectorAddress; uint16_t iFATSectorByteOffset = sDivResult.rem;
The line 5 with the "div" method call throws the compiler warning "function call has aggregate value".
I don't know what the compiler complains about and how to fix this.
Can someone explain whats wrong? I just copied the tutorial example?!