News for hackers. Stuff that matters.
Re:Three Things I Love About C by pmiller2 on Thursday May 13, 2010 @03:35AM (#1343607)
So, let me get this straight: he likes two things that aren't really a part of the C language (inline asm and the preprocessor), and gives a terrible example of using pointers to justify how great they are? Well, I'm convinced. :P

To put it in a less snarky way, sure, inline asm is great, but it's just a compiler-dependent extension. Also, there are plenty of non-C language compilers that implement it.

The preprocessor, OTOH, is somewhat more of a necessary evil when dealing with C. Beyond giving symbolic names to constants without having to actually allocate memory for them, the only real, good use I can think of for it is conditional compilation (which, granted, is a pretty good use). Oh, and, as devinj points out, the preprocessor has nothing really to do with C.

Pointers, I'll admit, are a great feature, but did he really have to give such a lousy example? It was kind of like Fire Marshal Bill telling me how cool propane torches are, but without the funny.

Re:Three Things I Love About C by devinj on Thursday May 13, 2010 @12:22AM (#1343278)
Macros are better because of performance? That's premature optimization if I ever saw it. OS-specific configuration / function definition is not going to be the performance bottleneck on pretty much any app I've seen. Maybe if you're writing a CGI program where it's run many times and has to do this setup each time, but then CGI is dead for a reason. Macros have plenty of problems that result in weird edge-case behavior, and I'd really rather not have them.

Oh, and finally, they aren't unique to C. You can use the macro preprocessor on any source code you like.