Consider below C program.
If we call as “func()”it will return constant 1. But it is also possible to call the function as “func((double *)&a)” which was supposed to return 1 but returning something else. The code was made to return constant 1 only! That’s a big problem but STRICT ALIASING fixes it.
Use restrict qualifier keyword. It means you promise the compiler that something is not aliased with the pointer restrict keyword. If you break your promise you will only suffer. Please refer restrict keyword in C for details.
GeeksforGeeks has prepared a complete interview preparation course with premium videos, theory, practice problems, TA support and many more features. Please refer Placement 100 for details
- Namespace in C++ | Set 3 (Accessing, creating header, nesting and aliasing)
- Else without IF and L-Value Required Error in C
- Difference Between C Language and LISP Language
- Pointer Arithmetics in C with Examples
- Difference between GCC and G++
- Difference and Similarities between PHP and C
- Format specifiers in different Programming Languages
- C program to find square root of a given number
- C program to print odd line contents of a File followed by even line content
- Getting System and Process Information Using C Programming and Shell in Linux
- Program to calculate Electricity Bill
- Program to print half Diamond star pattern
- C/C++ program for calling main() in main()
- Print all possible combinations of the string by replacing '$' with any other digit from the string
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.