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: Code: #include<signal.h> #include<stdio.h> #include<stdlib.h> void hey() { printf("!Signal Error! Program interrupted.... Division by zero or overflow\n"); getchar(); exit(1); } int main() { float z=0.1e-100,k=0.1e-100; signal(SIGFPE,hey); printf("%e",z/k);getchar(); } 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? psss. if you have found a weird mistake in my grammar, dont be very surprised, cause i m from russia
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.
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?
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.