- #include <stdlib.h>
- #include <stdio.h>
- #include <stdbool.h>
- bool is_negative(float x) {
- union {
- signed int si;
- unsigned int ui;
- double xx;
- float d;
- char bb[16384];
- } my_union = { .d = x };
- return my_union.ui & 0x80000000;
- }
- int main(int ac, char *av[])
- {
- float x;
- x = -1;
- x = 1;
- return EXIT_SUCCESS;
- }
c99_strict_aliasing_union/c99_strict_aliasing_union1.c
Posted by Anonymous on Wed 25th Aug 2021 11:11
raw | new post
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.