Part Number: MSP432P4011
Hi Team,
One of my customers wants to know how to use errno in MSP432 SDK, specially what will happens when a number is divided by 0, will errno show something?
thanks!
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Part Number: MSP432P4011
Hi Team,
One of my customers wants to know how to use errno in MSP432 SDK, specially what will happens when a number is divided by 0, will errno show something?
thanks!
The following setting in the .cfg determines what happens when you divide by zero
/* * Enable hardware exception generation when dividing by zero. * * Pick one: * - 0 (default) * Disables hardware exceptions when dividing by zero * - 1 * Enables hardware exceptions when dividing by zero */ m3Hwi.nvicCCR.DIV_0_TRP = 0; //m3Hwi.nvicCCR.DIV_0_TRP = 1;
If the above '1', an exception occurs and the application terminates. No changes are made to errno.
If the above '0', an excepption does not occur. I believe the result is 0, but please confirm with the ARM standard. Again, no changes are made to errno.
Todd
errno is defined in standard C, the OS has nothing to do with it. However, errno seems to only apply to the C standard library, it is unclear what happens with operators in expressions.
I should have pointed out that dividing by 0 is undefined, so *anything* can happen.
**Attention** This is a public forum