3 ms·
What do you typically use in C99 that you don't get in C89?
by dsrguru 14y ago
What do you typically use in C99 that you don't get in C89?
- oconnore 14y ago'for' loops
- _delirium 14y agoA few things I like, though not all of them are strictly needed: long long foo; /* bigger ints on 32-bit platforms */ uint32_t bar; /* stdint.h, integers of specific bit width */ int array[n]; /* length-n array, where n is a variable */ for (int i = 0; i < n; i++) /* loop-local variable */ Also, the safer stdio functions like snprintf.
- yuhong 14y agoSome of them are already in MSVC.
- stephencanon 14y agoOff the top of my head, C99 features that I've used in the past couple months: - declarations mixed with statements - declarations in `for` constructs - hexadecimal floating-point literals and conversion specifiers - the strtoxx( ) conversion routines - the restrict qualifier - the expanded math library - designated initializers - extended integer types - compound literals - // comments - VLAs - complex support Note that some of these features are still not present in C++11. C11 features that I have used in the past few months: - CMPLX macros - anonymous structures and unions - <stdalign.h>
- onedognight 14y agoI miss C99 named initializers even in C++. struct { struct y y; bool flag; } = { .flag = true };