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
0
votes
2 answers

Ansi C and Temporary Files

I need the integer file descriptor from a temporary file to be used in mmap. This need may need to change if there's no simple way to do this while still being standards compliant. I originally got a FILE stream using: FILE *tmpfile(); and then…
Harry
  • 11,298
  • 1
  • 29
  • 43
0
votes
1 answer

Program [X] has triggered a breakpoint, free Heap block [A] modified at [B] after it was freed

I'm developing a little program in ANSI C that generate a graph with dynamics array. When I run it in Visual Studio i get this error: "Program [X] has triggered a breakpoint, and in console is printed: "free Heap block [A] modified at [B] after it…
ununoctio
  • 3
  • 3
0
votes
2 answers

"Strong" Typing in C by one-element structs. What will the compiler do?

I'm planing use Structs containing an scalar field in my C Code, to do some semantic strong typing. The basic idea is macros for cheap "operations", that will fail on wrongly named struct fields, and of course more complex functions by strict…
Mark A.
  • 579
  • 4
  • 13
0
votes
1 answer

Char array pointer (pass by 'reference') not assigning (after sscanf variable change)

I've had these functions working fine, before I change one of the Strings via sscanf. I.e., If I have a char[] NAME that I create in the (called) function, and initialize it to a string (eg "fred";), then assign that to the passed parameter -> The…
OscuroAA
  • 252
  • 2
  • 17
0
votes
1 answer

php extension code must be c89 style

I wrote a php extension: https://github.com/binpack/binpack-php, it works great and I want to submit this extension to PECL. But they said that my code is C99 style and PHP except C89 style. I read somethings about C99 and C89. And figure out some…
srain
  • 8,944
  • 6
  • 30
  • 42
0
votes
3 answers

Initializing structures with dynamically allocated memory

I am having a hard time figuring out how to dynamically allocate memory and then initialize a struct with that memory. I am trying to make a binary tree and then set the children to have NULL as their 'word', this was I can test for NULL and insert…
v3nd3774
  • 55
  • 2
  • 8
0
votes
2 answers

C89: Need to declare functions before referncing them?

I'm new to C89, and it appears that you must declare a function before calling it. So this is unacceptable: void foo() { bar(); } void bar() { // do stuff } Because bar() is defined after foo() in the file. Is there any way to get around…
Nick Heiner
  • 119,074
  • 188
  • 476
  • 699
0
votes
1 answer

Parsing WEXITSTATUS int-summed return code(s) in C via bitwise operation

I'm only a novice when it comes to bitwise math - if that's even the correct term - and was looking for a better way to do logic on an int-summed return code (as is standard for various Unix programs). I.e. the return code could be any combination…
CosmicDan
  • 61
  • 2
  • 9
0
votes
2 answers

Is there any literature that proofs that printf's %f converts float to double?

I've read that printf's %f specifier is used for double and that it automatically converts float to double. But I couldn't find any proof in books (though it's stated on the web). I don't have access to a copy of the ANSI C standard files and I…
user2070245
0
votes
4 answers

Portable user defined character class division in C89 by a lookup table, would you do this?

static const int class[UCHAR_MAX] = { [(unsigned char)'a'] = LOWER, /*macro value classifying the characters*/ [(unsigned char)'b'] = LOWER, . . . } This is just an idea. Is it a bad one?
0
votes
1 answer

Assertions in C89?

I'm writing C89 on MSFT Visual Studio 2010 Beta. How can I make an assertion, similar to Java's assert keyword? I think I need to define a macro, but I'm not sure how. (It seems like this is something that's been done before, so I'd rather use that…
Nick Heiner
  • 119,074
  • 188
  • 476
  • 699
0
votes
2 answers

Mysql connection in Ansi c

I am working in Ansi C, windows platform. I want to attach mysql database to my c program. Kindly guide me how I can make it possible.
Siddiqui
  • 7,662
  • 17
  • 81
  • 129
0
votes
2 answers

How do I fix my resize function

This is all the code I have. The functions begining with zx are just so that when I'm done I can quickly put together a custom library based on those functions. The function I need help with is zxResizeGL which is used only on the WM_SIZE event…
user3218603
0
votes
1 answer

Is a dynamic array of void pointers a performance concern for game development in C?

Next semester, I'll be making a game in C (C89 specifically). Coming from higher-level languages such as C#, one of the first things I would do is make a List of Entities (game objects), and every frame, loop through each Entity and run their Update…
Adam Rezich
  • 3,122
  • 6
  • 31
  • 39
0
votes
1 answer

error C2275: illegal use of this type as an expression

Error is thrown at second line: HRESULT Direct3DDevice9Wrapper::GetLight(DWORD Index, D3DLIGHT9 *) { return Direct3DDevice9->GetLight(Index, D3DLIGHT9); } D3DLIGHT9 deffinition: typedef struct _D3DLIGHT9 { D3DLIGHTTYPE Type; …
Xardas
  • 1,777
  • 6
  • 20
  • 31