Questions tagged [c89]

This tag is for questions regarding the international standard ISO 9899:1990, also known as "C89", "C90" or "ANSI C", with amendments and technical corrigenda (as opposed to K&R C, C99, C11 or later C standard revisions).

The first C standard was released 1989 nationally in USA, by their national standard institute ANSI. This release is called C89 or ANSI-C. One year later, the American standard was accepted internationally and published by ISO (ISO 9899:1990). This release is called C90. Technically, it is the same standard as C89/ANSI-C, though formally, C90 replaced C89/ANSI-C, making them obsolete.

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

643 questions
11
votes
2 answers

The meaning of "EiC"

It appears that I am unable to find what "EiC" stands for. It has been used as an interpreter, semantic front end IDE similar to "Clang", but a little bit older. What is the meaning of it and why can I not find any reference to it?
Imobilis
  • 1,475
  • 8
  • 29
10
votes
3 answers

Does floor() return something that's exactly representable?

In C89, floor() returns a double. Is the following guaranteed to work? double d = floor(3.0 + 0.5); int x = (int) d; assert(x == 3); My concern is that the result of floor might not be exactly representable in IEEE 754. So d gets something like…
Jim Hunziker
  • 14,111
  • 8
  • 58
  • 64
10
votes
3 answers

Variable-length arrays in C89?

I've read that C89 does not support variable-length arrays, but the following experiment seems to disprove that: #include int main() { int x; printf("Enter a number: "); scanf("%d", &x); int a[x]; a[0] = 1; // ... …
jasonbogd
  • 2,451
  • 4
  • 31
  • 42
10
votes
3 answers

Adding or assigning an integer literal to a size_t

In C I see a lot of code that adds or assigns an integer literal to a size_t variable. size_t foo = 1; foo += 1; What conversion takes place here, and can it ever happen that a size_t is "upgraded" to an int and then converted back to a size_t?…
newguy
  • 617
  • 6
  • 15
10
votes
2 answers

HAT-trie in ANSI C implementation?

I am looking for ANSI C HAT-trie implementation released under some free license. I have not found one. Can you point me to some standalone implementation or a program that uses HAT-tries to get at least slight idea how to implement it the roght…
mjf
  • 101
  • 1
  • 3
10
votes
1 answer

Recommended Clang command line options

The Manual for Clang seems to be work in progress, so could you help me formulate the definitive command line options for compiling ANSI-C (AKA C89, C90) with maximum strictness and relevant/helpful warnings? Clang is a compiler front end for the …
xyz
  • 27,223
  • 29
  • 105
  • 125
10
votes
3 answers

C89 vs c99 GCC compiler

Is there a difference if I compile the following program using c89 vs c99? I get the same output. Is there really a difference between the two? #include int main () { // Print string to screen. printf ("Hello…
user69514
  • 26,935
  • 59
  • 154
  • 188
10
votes
3 answers

Returning the terminal cursor to start-of-line with wrapping enabled

I'm writing a filter (in a pipe destined for a terminal output) that sometimes needs to "overwrite" a line that has just occurred. It works by passing stdin to stdout character-by-character until a \n is reached, and then invoking special…
Oliver Charlesworth
  • 267,707
  • 33
  • 569
  • 680
9
votes
3 answers

Using sizeof() in array declarations in C89

I was under the impression that variable-size array declarations were not possible in C89. But, when compiling with clang -ansi I am able to run the following code: double array[] = { 0.0, 1.0, 2.0, 3.0, 4.0 }; double other_array[sizeof(array)] = {…
user755921
9
votes
4 answers

mixed declarations and codes

When I compile function with "gcc -o dene -Wall -ansi -pedantic-errors dene.c" ,gcc emits no error.(can you look a line which starts with char ....,in if loop,) static void remove_negation(char *s,char *s1) { char…
user319824
9
votes
1 answer

What does //**/ mean?

I have got snippet of old c-code with that lines (result is just slash sign): putchar('/' //**/ 1 / 1 /'\1'); Can anyone explain this snippet? What does this symbols mean? P.S. By the way it compiles well with std=c89 flag in gcc, but not with…
Alexander Myshov
  • 2,881
  • 2
  • 20
  • 31
9
votes
4 answers

How to define NaN value in ANSI C?

Possible Duplicate: NaN Literal in C? I'm writing a function in ANSI C which receives two numbers as parameters. The parameters are of int or float type. The number may or may not be valid according to my filter. How do I return some value…
Jack
  • 16,276
  • 55
  • 159
  • 284
9
votes
3 answers

Dereferencing in C

I've just started to learn C so please be kind. From what I've read so far regarding pointers: int * test1; //this is a pointer which is basically an address to the process //memory and usually has the size of 2 bytes (not necessarily,…
Meda
  • 2,776
  • 4
  • 20
  • 31
8
votes
4 answers

c89: Convert an int to void* and back

First off, this is not a dupe of: Is it safe to cast an int to void pointer and back to int again? The difference in the questions is this: I'm only using the void* to store the int, but I never actually use it as a void*. So the question really…
Robert S. Barnes
  • 39,711
  • 30
  • 131
  • 179
8
votes
2 answers

C Integral Overflow?

have a peek at this. The compiler is complaining that I have an integer overflow, but when I look at the C89 standard's rules for integral promotion along with the values in that expression, it seems to me that there is no overflow. rutski@imac:~$…
fieldtensor
  • 3,972
  • 4
  • 27
  • 43