Slashdot is powered by your submissions, so send in your scoop

 



Forgot your password?
typodupeerror
×
User Journal

Journal Journal: C Annoyances

I love C. It's my favorite language. Of course, as I work in the embedded systems field, I'd be very unhappy indeed if it were otherwise.

I love how it is a simple language (it's been said that it is a language that you can "hold in your head in its entirety", unlike C++). I love how the original reference book is the ultimate example of a well-made and concise manual. I love how it is universally supported. Most of all, I love how it maps to assembly in a pretty straightforward manner*.

But I'm still young, and I guess it's a sign of maturity that I start to realize its shortcomings and quirks.

- the difference between putting an include between or between "" ends up being arbitrary. Between carets, it is supposed to be a system include, and between quotes, it should be a user include. But with all the add-on user-libraries we install system-wide nowadays, the difference ends up being arbitrary and useless.

- multiple inclusions. A.c includes B.h and C.h, but B.h also includes C.h. Thus the compiler will complain that stuff defined in C.h is redefined. Hence the wonderful protections against multiple inclusions (#ifndef FOO\ #define FOO\ \ #endif FOO) that exist in header files around the world. Why this isn't yet handled automatically at CPP's level is beyond me.

- Actually, the whole include system is pretty broken. It stems from a technical problem, of course, but having to run around trying to find the include file that defines the function you need is unnecessary, nowadays. We've got powerful source-navigating engines, why aren't they included in the compilers?

- No multiple comment levels. When debugging, it is really useful to comment out a section of code, often increasingly larger. Or to comment out a section that includes comment. Nope, comments end at the first */, so not possible.

- why do people insist on hiding structs and enums inside opaque type names such as ts_thingie instead of a nice struct thingie? I find the latter so much clearer when going over code.

- portable code is a bloody mess full of #ifdef. Good luck trying to follow the flow of your code in that.

- TODO: put more stuff here.

Conclusion: this is just a rant that I needed to breathe out. Each problem I raised exists for a good reason and hasn't been universally solved for other good reasons, which I'm too lazy to research and give here (besides, that's not the point of a rant).
However, it's good spirit to know the limitations of the tools you're using.

I've got to do some Java some day.

*depends on the optimization level, of course, but that I can find the correspondence pretty easily most of the time never ceases to satisfy me.

User Journal

Journal Journal: writing vs publishing 1

I realize that this is the third post in a couple of days. I know that nobody reads this, but at this point it doesn't matter.

Why?

Because what's important to me is the need to express myself. That this doesn't reach anybody, that I get no feedback, is not important to the psychological mechanisms that make me write this. The only act of writing it down is enough to satisfy the urge. Anything else is bonus.

In fact, I believe that the important aspect of writing this is just to articulate my thoughts. As long as they stay in my mind, they are a confused mess. Only by writing it down can I see whether they make any sense.

Maybe I'm just fooling myself. Of course, if it gets to the point that I have to write it down, the thoughts are already articulate enough.

User Journal

Journal Journal: GPL vs BSD

Still today, in mid-2007, more than 18 years after the publication of the original GPL, and about the same time for the BSD license, people are still arguing about whether the GPL or BSD is the most free (as in speech) license.
Let's make is simple: BSD allows you to do much more with the code, at the expense of the freedom provided with subsequent modifications of the code. GPL restricts the way you can use the code, so that subsequent versions can enjoy the same freedom. GPL really is as free as can be, provided that freedom stays intact.
So there is more freedom with version N of BSD code than there is with GPL code, but you have no guarantee for modification N+1 of BSD code, whereas GPL code stays just as free.
Ask HP-UX users if they enjoy the same liberty with their system's code as HP did. Then ask GNU/Linux users if they enjoy the same liberty as the kernel hackers.

This has an impact on the quality evolution of software released under those licenses. With a BSD license, you can never insure that the original code will enjoy improvements made by licensees. You can always, technically, bring those improvements back to the original GPL code.

BSD code will be used far and wide. You'll get nice warm feelings to know that your code was used in the PS3, for example, though you'll never get to try it yourself, as the modifications will never come back to you. If you'd rather have that nice warm feeling, knowing that you helped out other people out of pure altruism (even if it enabled them to make billions of dollars[1] and they didn't give a cent back to you. Yeah, I'm flaming), then go BSD.
GPL ensures that everyone continues to enjoy the same liberty. As such, all changes are public, and can make their way back to the original source. So if you want your code to continue to improve from other's contributions, go GPL. Of course, this'll be at the expense of how far your code will spread, but otherwise that further spread won't benefit you (or your code). That warm feeling won't be as strong, but your code, your baby, will be better off.

If you really believe in freedom, what's the use of a freedom you can't ensure will last?

And by the way, downloading that pirated version of Spiderman 3 is the same copyright violation as using GPLed code in a proprietary application.

[1] at one point Windows' TCP/IP stack behaved identically to a BSD's, implying identical code.

[edit] About libraries: Not all GPL code is stand-alone. Some of it is part of libraries, and in this case, the GPL does strongly limit the use of the library in more ways than for stand-alone software. Libraries are components of larger software, and they are worthless by themselves. The GPL restricts the use of a library in that you cannot use it in non-GPL software. It is viral in the way that to use a GPL library, the whole software has to become GPL. The LGPL license exists so that you can still have a library under a GPL-like license, but it doesn't extend to the application using it.

Slashdot Top Deals

All seems condemned in the long run to approximate a state akin to Gaussian noise. -- James Martin

Working...