Questions tagged [c99]

This tag is for questions regarding the International Standard ISO 9899:1999, aka "C99", with technical corrigenda, and for questions about code written in C99 (as opposed to K&R C, C89 or later C Standard revisions like the 2011 revision C11).

This tag is for questions regarding the International Standard ISO 9899:1999 , aka "C99", with technical corrigenda, and for questions about code written in C99 (as opposed to K&R C, C89 or later C Standard revisions like the 2011 revision C11).

Always use the tag for all your C questions, then complement it with the tags for questions that are specific to this version of the standard.

1900 questions
14
votes
6 answers

What is the point of the C99 standard?

C99 adds several useful features to the language, yet I find it difficult to recommend any practice which depends upon C99. The reason for this is because there are few (any?) actual implementations of the C99 language. Sure, there is limited…
Billy ONeal
  • 104,103
  • 58
  • 317
  • 552
14
votes
1 answer

Taking address of temporary (compound literal) parameter in C

I can't imagine this isn't already duplicate, but I can't easily find the answer since the more complex scenarios specifically to C++ seem to dominate the discussion0. Is it legal to take take the address of a temporary constructed in the parameter…
BeeOnRope
  • 60,350
  • 16
  • 207
  • 386
14
votes
3 answers

How to force unsigned arithmetic on fixed-width types?

The following (C99 and newer) code wants to compute a square, restricted to the same number of bits as the original fixed-width type. #include uint8_t sqr8( uint8_t x) { return x*x; } uint16_t sqr16(uint16_t x) { return x*x;…
fgrieu
  • 2,724
  • 1
  • 23
  • 53
14
votes
7 answers

What is wrong with using turbo C?

I always find that some people (a majority from India) are using turbo C. I cannot find any reason to use such outdated compiler... But I don't know what reasons to give when trying to tell them to use modern compiler(gcc,msvc,...).
Nyan
  • 2,360
  • 3
  • 25
  • 38
14
votes
3 answers

Why are typedef identifiers allowed to be declared multiple times?

From the C99 standard, 6.7(5): A declaration specifies the interpretation and attributes of a set of identifiers. A definition of an identifier is a declaration for that identifier that: for an object, causes storage to be reserved for that…
14
votes
3 answers

C99 Structure Designated Initialisers and other value

I am aware that in C99 you can initialize members of the structure using member name as follows : struct myStruct { int i; char c; float f; }; So following is valid : struct myStruct m = {.f = 10.11, .i = 5, .c = 'a'}; Also it is said that…
Sagrian
  • 1,048
  • 2
  • 11
  • 29
14
votes
3 answers

Is the next C standard actively developed?

Is there currently a group working on the next C standard (by next, I mean after C99)? If so, what are the features likely to make it in?
siam
14
votes
5 answers

Inconsistent behaviour of implicit conversion between unsigned and bigger signed types

Consider following example: #include int main(void) { unsigned char a = 15; /* one byte */ unsigned short b = 15; /* two bytes */ unsigned int c = 15; /* four bytes */ long x = -a; /* eight bytes */ printf("%ld\n",…
Grzegorz Szpetkowski
  • 36,988
  • 6
  • 90
  • 137
14
votes
4 answers

Sequence points and side effects: Quiet change in C11?

C99 §6.5 Expressions (1) An expression is a sequence of operators and operands that specifies computation of a value, or that designates an object or a function, or that generates side effects, or that performs a combination thereof. (2) Between…
mafso
  • 5,433
  • 2
  • 19
  • 40
14
votes
4 answers

ftell at a position past 2GB

On a 32-bit system, what does ftell return if the current position indicator of a file opened in binary mode is past the 2GB point? In the C99 standard, is this undefined behavior since ftell must return a long int (maximum value being 2**31-1)?
Vilhelm Gray
  • 11,516
  • 10
  • 61
  • 114
14
votes
4 answers

What technical disadvantages do C99-style VLAs have?

I heard from many people that variable length array, introduced in C99, are terrible. Some guys on IRC said a minute ago « I don't think C++ will get VLA's, strousoup made some very negative comments about them ». What are the reasons why those…
qdii
  • 12,505
  • 10
  • 59
  • 116
14
votes
5 answers

Is there a 'printf' conversion specifier for _Bool?

With printf(), I can use %hhu for unsigned char, %hi for a short int, %zu for a size_t, %tx for a ptrdiff_t, etc. What conversion format specifier do I use for a _Bool? Does one exist in the standard? Or do I have to cast it like this: _Bool foo =…
Richard Hansen
  • 51,690
  • 20
  • 90
  • 97
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
13
votes
3 answers

Why aren't fixed-point types included in C99?

Thankfully, the complex type modifier was introduced into C99 standard. What I don't understand is why it was decided to omit support for fixed point arithmetic (specifically, support fractional types like 1.15 {signed} or 0.32 {unsigned}) where…
ysap
  • 7,723
  • 7
  • 59
  • 122
13
votes
1 answer

Cleaning up C/C++ code reveals problems with variadic macros

We're doing some code cleanup, fixing signed/unsigned comparisons, running static analysis, etc, on the code base of C, C++, and Java. One of the warnings we're getting is warning: ISO C does not permit named variadic macros And its companion…
Petriborg
  • 2,940
  • 3
  • 28
  • 49