Questions tagged [gnu99]

GNU dialect of ISO C99.

C99 is simply the version of the C standard as of 1999 as we all know it. In GCC it is not fully supported. ISO C99 plus GNU extensions. When ISO C99 is fully implemented in GCC, this will become the default. The name gnu9x is deprecated.

GCC Manpage

12 questions
14
votes
1 answer

Why does C99 complain about storage sizes?

This is some code I'm compiling on Linux: #include 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:…
Jim Hunziker
  • 14,111
  • 8
  • 58
  • 64
8
votes
2 answers

C99: Flexible array inside union?

I tried to convert something from using the struct hack to using a flexible array member, only to run into the following error message: error: invalid use of structure with flexible array member (GCC 4.8.1, gnu99, MinGW) After trying to track down…
TLW
  • 1,373
  • 9
  • 22
8
votes
1 answer

Why must I use gnu99 instead of c99 to compile a kernel module?

I am used to using -std=c99 to enable c99 features when compiling application code. Recently I have been following some basic kernel module examples, and added ccflags-y := -std=c99 to the makefile. However this resulted in 17K lines of errors when…
jsj
  • 9,019
  • 17
  • 58
  • 103
7
votes
3 answers

floats smaller than FLT_MIN. why FLT_TRUE_MIN?

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 #include #include…
Victor
  • 5,697
  • 6
  • 34
  • 41
4
votes
2 answers

Bitwise "not" operator in C returns signed result

Consider this code: uint16_t a = ~ ( uint16_t ) 0; int16_t b = ~ ( int16_t ) 0; printf ( "%d %d %d %d\n", a == ~ ( uint16_t ) 0, a == ( uint16_t ) ( ~ ( uint16_t ) 0 ), b == ~ ( int16_t ) 0, b == ( int16_t ) ( ~ ( int16_t )…
puchu
  • 3,294
  • 6
  • 38
  • 62
3
votes
3 answers

C printf specifier %lld prints characters "ld"

I am developing using gcc (-std=gnu99) for an embedded toolchain (Myriota), and I have problems with printf. when I try the following code: long long int time = TimeGet(); printf("\nSeconds since epoch: %lld\r\n", time); it prints: Seconds since…
bot1131357
  • 877
  • 8
  • 25
2
votes
2 answers

Can someone please explain the difference between these two initiliazers?

I was wondering if someone could provide a detailed, simple explanation of the differences between the two of the following pieces of code. Given the following definition: typedef struct { stuff; stuff_2; } variable_t; What is the…
2
votes
1 answer

libmagic close file descriptor on NetBSD

I’m writing a FastCGI for providing zlib compression on static content for web providers which doesn’t, and I’m experiencing problems withmmap()on NetBSD. #include #ifndef MADV_DONTFORK #define MADV_DONTFORK 0 #endif #ifndef…
user2284570
  • 2,891
  • 3
  • 26
  • 74
2
votes
1 answer

How to deal with "warning: inline function `*stat64` declared but never defined" in gcc with gnu99 support

I am including stat.h in my foo.c as follows: #include When I compile this as follows: gcc -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE=1 -DUSE_ZLIB -DUSE_BZLIB -O0 -g -Wformat -Wall -Wswitch-enum -Wextra -std=gnu99 -DDEBUG=1 -c foo.c…
Alex Reynolds
  • 95,983
  • 54
  • 240
  • 345
0
votes
3 answers

Any way to get fdopen functionality with C99?

Apparently fdopen requires a POSIX/gnu99 using compilation standard. I am hoping to stay on C99. I am running into this problem because I use open() to create a file descriptor and then (because I use fgets()) I need a FILE pointer which is…
Tyler Durden
  • 11,156
  • 9
  • 64
  • 126
0
votes
2 answers

Is 'redefining' variables in statement expressions safe?

My question is regarding statement expressions, which are added as an extension in GNU C. Consider the following code: #include #include int main(void) { int i = 0; printf("%d\n", i); {int i = 1;printf("%d\n",…
Mike Kwan
  • 24,123
  • 12
  • 63
  • 96
-2
votes
2 answers

If something is a const volatile int, can it change based on the status of a variable?

I have a unsigned const volatile short int*. I want it to be (x + y), which at time of defining is set to 0. However, i want if for some reason y changes to 5, i would want the unsigned const volatile short int* to change too. Would this be possible…
180Five
  • 13
  • 5