The function is as following
***********************
const char *dump_float(
const float &real // reference to float to be output
)
// PUBLIC FUNCTION: dump_float() - format a float for dump.
// This function returns a pointer to a 0-terminated character
// vector containing the value of the float "real" formatted for
// use in an object dump. It handles the case(s) in which the data
// does not have a valid floating point representation. Such a
// situation can arise when a union field of more than one data type
// is interpreted as a float.
{
// save the float in a global so that the signal handler can output
// the value if signal occurs.
u_val.p_val = *((void**)(&real));
// GNU strstream ctor does not take a mode
#ifdef __GNUC__
strstream out(ptr_buf, buf_size);
#else
strstream out(ptr_buf, buf_size, ios::out);
#endif
out_p = &out;
// set up the handler for the SIGFPE signal (if appropriate)
sig_handle_func_p prev_sigfpe_val = (sig_handle_func_p) signal(SIGFPE,
SIG_IGN);
if (prev_sigfpe_val != (sig_handle_func_p)SIG_IGN) {
// install own signal handler
signal(SIGFPE, sigfpe_handler);
}
// dump the floating point representation of the scalar value
if (setjmp(sjbuf) == 0) {
sprintf(pbuf, "%-15g", (double)real);
out << pbuf;
}
if (prev_sigfpe_val != (sig_handle_func_p)SIG_IGN) {
// restore the original action in the event of the SIGFPE signal.
signal(SIGFPE, prev_sigfpe_val);
}
return ptr_buf;
}
*********************************************
It is compiled with the forte 6 Solaries compiler, and the error is: Error:
Could not find a macth for std::signal(int, void(*)(int))
Could anyone help???
Ahmed Ossman
"Alf P. Steinbach" <al***@start.no> wrote in message
news:3f****************@News.CIS.DFN.DE...
On Tue, 22 Jul 2003 14:11:48 +0300, "Ahmed Ossman"
<ah**********@mentor.com> wrote:I want to save the return value from the signal() function,
At your current level, absolutely don't use signal(). It's
incompatible with many C++ features.
what is the type of the variable.
i.e. I want to do the following:
<variable type?> ret_sig = signal(......);
The result type is specified in the function declaration.
I need it soo much.
You don't. If you can explain what you're trying to _achieve_
by using signal(), perhaps we can help you.