Register
View RSS Feed

//no comment

Sapu Presents Fun with C

Rate this Entry
Warning, technical speak below. This isn't really a blog post as much as a comment on a website I came across.

I always enjoy learning about and using the syntactical sugar of programming languages and really understanding how the programming language functions at its core. Most of my day-to-day programming is done in C as I do a ton of work with embedded systems (ie microcontrollers). A few days ago, I came across this website which has a bunch of tricky questions about C (some are better than others).

I found the first one particularly cool as I'd never even heard of using a ':' to specify bit fields before and this is an extremely useful thing for low-level embedded applications. For example, communication protocols often require headers which have fields that are less than 8-bits wide. Using this operation in the struct declaration makes the code much more readable and much easier to write. It lets the compiler handle all the bit manipulation for you!


PS: Bonus points to whoever caught the reference in the title.

Comments

  1. Sinshroud's Avatar
    Haha the blog post name totally made me think of

  2. Sapu94's Avatar
    Quote Originally Posted by Sinshroud
    Haha the blog post name totally made me think of

    Guess it wasn't subtle enough then :P
  3. Kathroman's Avatar
    +1 For Goodburger!! Awesome movie.

    OT - I love language nuances like this. My boss at work is in his words "old school" and he's taken it upon himself to prove to me that "coding in notepad" is an actual thing. I never tire of swinging around to look over his shoulder when some code doesn't work to spot a missed semi-colon, or a missing end tag or something little like that. To the outside world, I'm sure it seems trivial and unnecessary, but I think it's actually pretty cool and powerful to think that such absolute precision is often required to avoid bringing huge applications/architectures to their proverbial knees.
  4. Lumi's Avatar
    +1