MessageBox etc. in a constructor, would you do that?

Written by kishore

what do you think, is showing a message box in a constructor of some class a bad practice? (or any other interaction with the user while initializing an object)

Go to Source

Jan
31

Effect of a ‘double to float’ overflow ?

Written by kishore

I’m converting some code that someone else wrote. One of the header files contains this inline function:-

Code:

static inline float minus_infinity() { return -HUGE_VAL; }

In VC++ HUGE_VAL isn’t a float; it’s a double, so will this function actually return the correct value? I read somewhere (admittedly for C#) that overflowing a float causes it to return NaN. So will the above code behave sensibly? And will it even exhibit the same behaviour with different compilers? :confused:

Go to Source

Jan
31