A lot of those don't seem to be "features" so much as they are "language quirks". No one experienced with C finds it odd that you can take int *my_int_array = malloc(n * sizeof(int)) and do...
A lot of those don't seem to be "features" so much as they are "language quirks". No one experienced with C finds it odd that you can take int *my_int_array = malloc(n * sizeof(int)) and do my_int_array++, after all, despite the idea of incrementing an array being absurd in most (all?) higher-level languages.
These little quirks make a lot more sense when you realize that under the hood, C is largely just performing operations on memory addresses. Therefore incrementing an array is really just incrementing the memory address value, placing you at the next position in memory i.e. where the next array element is located. (I know, this really over-simplified, please don't crucify me.)
It's akin to how PHP has the language quirk of treating all arrays as ordered maps, even flat numerically-indexed arrays. It's not that it's a feature, it's just the way the language was built. Speaking of PHP, its switch syntax validation is more strict than C's, which I find hilarious. Take that, C elitists!
That shit don't all burn down and explode is a huge thing when you read about C and C++: it is worse than Perl. Tiny cryptic bits of syntax can change so much at the machine level. You are either...
That shit don't all burn down and explode is a huge thing when you read about C and C++: it is worse than Perl. Tiny cryptic bits of syntax can change so much at the machine level. You are either a C guru or you are writing horrible bugs. It is really a design failure.
A lot of those don't seem to be "features" so much as they are "language quirks". No one experienced with C finds it odd that you can take
int *my_int_array = malloc(n * sizeof(int))
and domy_int_array++
, after all, despite the idea of incrementing an array being absurd in most (all?) higher-level languages.These little quirks make a lot more sense when you realize that under the hood, C is largely just performing operations on memory addresses. Therefore incrementing an array is really just incrementing the memory address value, placing you at the next position in memory i.e. where the next array element is located. (I know, this really over-simplified, please don't crucify me.)
It's akin to how PHP has the language quirk of treating all arrays as ordered maps, even flat numerically-indexed arrays. It's not that it's a feature, it's just the way the language was built. Speaking of PHP, its
switch
syntax validation is more strict than C's, which I find hilarious. Take that, C elitists!I was expecting a lot of bitwise operator magic.
Never seen for loops in a switch statements; that's kinda neat.
But this:
hahahaha I love it.
That shit don't all burn down and explode is a huge thing when you read about C and C++: it is worse than Perl. Tiny cryptic bits of syntax can change so much at the machine level. You are either a C guru or you are writing horrible bugs. It is really a design failure.
My guess is that
#
with no arguments resolves to an empty line.https://gcc.gnu.org/onlinedocs/cpp/Stringizing.html#Stringizing