Javier del Valle

safe conversions?

Discussion created by Javier del Valle on Apr 18, 2006
Latest reply on Apr 19, 2006 by Tom Thompson
Dear all,

I am looking for some code samples before trying to reinvent the wheel. I need to convert from several numeric types to other numeric types. I mean,

from char to int
from int to char
from unsigned int to int
from int to unsigned int
...
from float to int
from int to float.
..and more of these kind.

I need to check that no overflows underflows happen, using asserts. So I am looking for some code sample that can do what I need.

I am also looking for a string to numeric(int, char, float) and numeric to string converter.

I would appreciate any info,

thanks a lot and best regards,

otomi

Outcomes