8 votes

Topic deleted by author

4 comments

  1. Emerald_Knight
    Link
    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!

    4 votes
  2. Ember
    Link
    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.

    I was expecting a lot of bitwise operator magic.

    Never seen for loops in a switch statements; that's kinda neat.

    But this:

    You can thus write some absolute madness such as 41[yourarray + 1].

    hahahaha I love it.

    1 vote
  3. unknown user
    Link
    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.