Categories
C/C++

“I do not think that word…

I’ve often had discussions with programmers about the subtleties of the language. They believe they understand what a language keyword is supposed to do, and use it that way — but they’re often mistaken, or not fully informed.

I’ve started a list of C and C++ keywords that have subtle differences from the “common” understanding of their usage. I expect to add more: please add your suggestions below.

Categories
C/C++

Pointers in C & C++

A long (long!) time ago I answered a question on Stack Exchange, but it is still applicable today:

Many programmers have a disjoint between a pointer and an array. Here’s an explanation.

Categories
C/C++

C/C++ function pointers

A while ago I edited the Wikipedia article on function pointers to explain an alternate syntax that I’ve used for years, but no-one else seems to. My way seems to me to be much clearer and more concise than the “canonical” one described in all the text books—so why isn’t everyone using it?

I’ve just assumed that it was lack of knowledge, so I’ve posted about C/C++ function pointers directly here.

Categories
C/C++

C/C++ struct bit fields: a proposal

I wrote a series of articles about struct bit fields: how they’re not used; how they are used; their limitations, both architecturally and as implemented by the compiler; and hardware considerations.

And those articles offer solutions for the various deficiencies that apparently cause many programmers to not use them, citing (especially) code portability as a concern.

But there is one “killer” scenario (in the bad sense) that makes struct bit fields practically impossible to use in that case. So I wrote a C/C++ language proposal to fix it!