Questions tagged [c99]

C99 is the latest standard of the general purpose C programming language. It was adopted as an ANSI standard in the year 2000.

12 questions
10
votes
3 answers

Does C99 make the K&R book outdated? If so what to recomend in its place?

C99 has been with us for a while now. It introduces a lot of features that are not in K&Rs The C Programming Language. None of them are particularly radical. However, even small features like being able to intermingle declarations and code change…
Justin Dearing
  • 879
  • 1
  • 7
  • 18
9
votes
5 answers

Definition of portable C

I have been having a huge and heated argument with someone on a slack group - the debate is this : My argument Portable code is that which compiles with various compilers and runs exactly the same on various architectures without modification. If…
rep_movsd
  • 209
  • 2
  • 6
8
votes
4 answers

Static vs. non-static? (with non-OOP functions)

Although this question has come up before, mine is different because it is not supposed to cover anything OOP but only plain (ANSI) C. Especially in open-source software, I usually encounter a plethora of functions (please don't call them methods…
syntaxerror
  • 189
  • 1
  • 1
  • 5
8
votes
4 answers

What situations are appropriate for C# to C interop?

Given that C# has the unsafe keyword, are there situations in which it would still be beneficial to interoperate with C libraries? I could see the need for very fast number crunching, graphical manipulation or matrix operations, using pre-existing C…
Robert Harvey
  • 198,589
  • 55
  • 464
  • 673
6
votes
4 answers

Which version of C should I learn?

It looks like K&R "C Programming Language (2nd Edition)" covers ANSI C, but another book that I'm starting (Stephen G. Kochan "Programming in C") says that it uses C99. I'm coming from a C#/JavaScript/Python/PHP/Java background and looking to round…
Nogwater
  • 171
  • 1
  • 5
5
votes
3 answers

Should one avoid or be careful with C99 features in C code?

Some seem to say that one should avoid C99 features in C code as compilers don't really support those features. C99 is a standard from 1999, shouldn't these features be quite widespread now? Should one avoid using C99 features in new code? In legacy…
Anto
  • 11,157
  • 13
  • 67
  • 103
3
votes
1 answer

How to make my educational dynamic array C library less verbose to use?

I really like to make tools prior to starting some assignment, so for the C programming assignments I have prepared dynamic array library. We are restrained to only using C99 standard. Note that all programming I'm describing below is, as per…
Tomáš Zato
  • 853
  • 1
  • 10
  • 20
3
votes
2 answers

Complex iterators in C

note: this was originally asked on SO. Part of my current project involves iterating over sequences that don't necessarily exist. For example, I have something similar to a relational database in memory, so say I have three arrays typedef struct {…
Gage
  • 131
  • 3
2
votes
2 answers

C99: Alternative to "static" variable declaration?

By coincidence I stumbled over "The New C Standard" from Derek M. Jones, where he comments this sentence from the C99 standard regarding "storage duration of objects": There are three storage durations: static, automatic, and allocated. His…
mic
  • 137
  • 2
2
votes
1 answer

Memory/cache performance in working with arrays in C

I've been toying with some array examples in C. I want to understand more about memory concepts, alignment, and cache. Especially on large arrays on heap. Sometimes I work on large images (extremely large) so that's why it's important to me, but it…
Keyframe
  • 121
  • 1
  • 6
2
votes
2 answers

Function naming design in a C Library

I'm writing a C (c99) library that operates on strings. I'm having a design problem writing functions that will perform in different modes. For example; the Find function can search for: the first, last, n-th element different letter case return…
reader
  • 123
  • 3
0
votes
1 answer

Why are zero length VLAs allowed in C99, but not in C11 any more?

In the comments to this former question, there was a discussion if the C standard allows variable length arrays (VLAs) of length 0 or not. As it turns out, the C99 standard states: In 6.7.5.2 Array declarators, Constraints: "If the expression [for…
Doc Brown
  • 199,015
  • 33
  • 367
  • 565