Tagged Questions
13
votes
8answers
2k views
Why is x=x++ undefined?
It's undefined because the it modifies x twice between sequence points. The standard says it's undefined, therefore it's undefined.
That much I know.
But why?
My understanding is that forbidding ...
4
votes
6answers
636 views
why are both index[array] and array[index] valid in C?
For example consider:
int index = 3;
int array[4] = {0, 1, 2, 3};
then both index[array] and array[index] are valid expressions, much like *(index + array) and *(array + index).
In C arrays why is ...
11
votes
9answers
1k views
Greenspun's Tenth Rule, does every large project include a Lisp interpreter?
Greenspun's tenth rule (actually the only rule) states that:
Any sufficiently complicated C or Fortran program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of ...
5
votes
3answers
444 views
Why is scanf called scanf? (Same for printf.)
I am just curious why in the C programming language the function to read formatted input was called "scanf" as opposed to "readf". I assume it is derived from an earlier language, so in that case why ...
4
votes
3answers
625 views
Is macros support in a programming language considered harmful?
The first abuse that comes to my mind in C is:
#define if while
But at the same time it is extremely handy and powerful when used correctly.
Something similar happens with Common Lisp macros.
...