Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Signal fu-ion (http://www.go4expert.com/forums/signal-fu-ion-t4111/)

aVague 2May2007 12:43

Signal fu-ion
if somebody not knowing:
signal functions are used to check operation like 0.1e-100/10e+100 for if the result out of range of double(float,...) or not
from the theory :
if we have digital forms of some numbers : 1110101010 and 1100101010 (same size ,of course) , while additioning them , we can have 1 , that is nowhere to write ( no place) , in this situation , proc-or put a flag on this operation and the signal func-ion read this flag...

ok, now practise - example is:



void hey()
  printf("!Signal Error! Program interrupted.... Division by zero or overflow\n");
int main()
float z=0.1e-100,k=0.1e-100;


working in Builder, but doesnt in Mvs( microsoft visual studio 2005),
the questions are , what 1)why and maybe 2) what shall i do , to make it work?

if you have found a weird mistake in my grammar, dont be very surprised, cause i m from russia

DaWei 3May2007 02:27

Re: Signal fu-ion
Signals are not a C thing. They are a platform-dependent thing. They are common in Unix-like systems, but not in Windows-type systems. Windows uses exceptions and messages differently. This is not to say that a signalling system could not be implemented on a Windows platform, but it would be an implementation specific thing.

aVague 3May2007 21:47

Re: Signal fu-ion
i see , so comiler gives me ways to declare signal(...) ( token from signal.h, visual studio 2005):

"\Mvs\VC\include\signal.h(91): could be 'void (__cdecl *signal(int,void (__cdecl *)(int)))(int)'

or 'void (__clrcall *signal(int,void (__clrcall *)(int)))(int)'

or 'void (__clrcall *signal(int,int))(int)' "

as i think, __cdel means c - declaration (or not?) , then comes sight * means ,that function has atomatically activation - my suggestion, then comes 1st argument - signal code, then comes some function with some special property(??what property??) or (in last variant) number of returning value ( equal to exit(that number)
so that are my suggestions, how right they are?

DaWei 3May2007 23:22

Re: Signal fu-ion
You will notice that the choice is made according to various preprocessor #if statements. This means that the interpretation will depend upon earlier preprocessor definitions. You will just have to chase all those down to see what your particular implementation (set of code) is doing. MSDN and Google should be able to handle that for you.

aVague 4May2007 00:26

Re: Signal fu-ion
thx, ll see

All times are GMT +5.5. The time now is 03:28.