gnu99

floats smaller than FLT_MIN. why FLT_TRUE_MIN?

…衆ロ難τιáo~ 提交于 2019-12-09 12:04:25
问题 In an attempt to see what would happen in the case of a float underflow I found that I could make float numbers much smaller than FLT_MIN. I'm using xcode 5.1 on OS 10.9. The language dialect is gnu99. #include <stdio.h> #include <stdlib.h> #include <float.h> int main(int argc, const char * argv[]) { float underflow = FLT_MIN * 0.0000004; printf("Float min is %f or %e.\nUnderflow is %f or %e\nMin float exp is %d.\n", FLT_MIN, FLT_MIN, underflow, underflow, FLT_MIN_10_EXP); return 0; } Prints:

floats smaller than FLT_MIN. why FLT_TRUE_MIN?

◇◆丶佛笑我妖孽 提交于 2019-12-03 14:43:45
In an attempt to see what would happen in the case of a float underflow I found that I could make float numbers much smaller than FLT_MIN. I'm using xcode 5.1 on OS 10.9. The language dialect is gnu99. #include <stdio.h> #include <stdlib.h> #include <float.h> int main(int argc, const char * argv[]) { float underflow = FLT_MIN * 0.0000004; printf("Float min is %f or %e.\nUnderflow is %f or %e\nMin float exp is %d.\n", FLT_MIN, FLT_MIN, underflow, underflow, FLT_MIN_10_EXP); return 0; } Prints: Float min is 0.000000 or 1.175494e-38. Underflow is 0.000000 or 4.203895e-45 Min float exp is -37. Is

Why does C99 complain about storage sizes?

泄露秘密 提交于 2019-11-27 14:45:24
This is some code I'm compiling on Linux: #include <net/if.h> int main() { struct ifreq ifr; } gcc test.c is fine. gcc -std=gnu99 test.c is fine. gcc -std=c99 test.c fails with the following error: test.c: In function ‘main’: test.c:4:16: error: storage size of ‘ifr’ isn’t known What's different about C99 that it doesn't like the definition of struct ifreq in Linux? It's a chain of consequences of preprocessing and GNU C vs C99. First up, net/if.h : net/if.h includes features.h Later on, it defines struct ifreq inside a #ifdef __USE_MISC block. So: What is __USE_MISC ? -- it is stuff common to

Why does C99 complain about storage sizes?

为君一笑 提交于 2019-11-26 16:53:58
问题 This is some code I'm compiling on Linux: #include <net/if.h> int main() { struct ifreq ifr; } gcc test.c is fine. gcc -std=gnu99 test.c is fine. gcc -std=c99 test.c fails with the following error: test.c: In function ‘main’: test.c:4:16: error: storage size of ‘ifr’ isn’t known What's different about C99 that it doesn't like the definition of struct ifreq in Linux? 回答1: It's a chain of consequences of preprocessing and GNU C vs C99. First up, net/if.h : net/if.h includes features.h Later on,