Volatile is extra or not?

Viewed 86

This is a sample function(C++) of alglib library used for equal checking:

ae_bool ae_fp_eq(double v1, double v2) {
    /* IEEE-strict floating point comparison */
    volatile double x = v1;
    volatile double y = v2;
    return x==y;
}

What is the reason for using volatile in this code?

What's wrong if removing it?

0 Answers
Related