Last active
August 29, 2015 14:11
-
-
Save welll/e8f4e2bcce66332663a2 to your computer and use it in GitHub Desktop.
Using typedef to function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef int myinterger; | |
typedef int (*fn_adder)(int, long); | |
int sum(int a, long b){ | |
return a+b; | |
} | |
int main(int argc, char *argv[]){ | |
fn_adder temp = ∑ | |
int result = (*temp)(1,3); | |
return 0; | |
} | |
//http://stackoverflow.com/questions/4295432/typedef-function-pointer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
C/C++ software memory corruption types: | |
There are two forms of Linux Memory accessible to the programmer: | |
User's virtual memory space in which application is run. | |
Register memory. | |
The most obvious memory errors result in a "Segmentation violation" message. This may alert the programmer to the location of the memory error when the program is run in gdb. The following errors discussed are the not so obvious errors. | |
Memory errors: | |
Heap memory errors: | |
Attempting to free memory already freed. | |
Freeing memory that was not allocated. | |
Attempting to write to memory already freed. | |
Attempting to write to memory which was never allocated. | |
Memory allocation error. | |
Reading/writing to memory out of the bounds of a dynamically allocated array | |
stack (local variables) memory errors: | |
Reading/writing to memory out of the bounds of a static array. (array index overflow - index too large/underflow - negative index) | |
Function pointer corruption: Invalid passing of function pointer and thus a bad call to a function. | |
http://www.yolinux.com/TUTORIALS/C++MemoryCorruptionAndMemoryLeaks.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment