Kuro5hin.org: technology and culture, from the trenches
create account | help/FAQ | contact | links | search | IRC | site news
[ Everything | Diaries | Technology | Science | Culture | Politics | Media | News | Internet | Op-Ed | Fiction | Meta | MLP ]
We need your support: buy an ad | premium membership

[P]
Glib is retarded and GNU developers are insane

By omghax in omghax's Diary
Tue Aug 12, 2003 at 11:11:43 PM EST
Tags: (all tags)

"gpointer
typedef void* gpointer;

An untyped pointer. gpointer looks better and is easier to use than void*.
"

HMM.

"gconstpointer
typedef const void *gconstpointer;

An untyped pointer to constant data. The data pointed to should not be changed.

This is typically used in function prototypes to indicate that the data pointed to will not be altered by the function.
"

HMM.


I'm reading the documentation for fun while my friend installs Starcraft and it goes on and defines data types that are "guaranteed to be <x> in size" when the C standard did that a long time ago, I think. Maybe it's C99 but most libraries have that header. It takes, what, a minute to write?

Not only this, but it has its own memory allocation routines. As if stdlib isn't good enough. The dynamic array syntax isn't too horrible but I have my doubts as to its efficiency behind the scenes and I further wonder if it's really that useful.

Then, of course, there's this gem:

"GCompareFunc ()
gint        (*GCompareFunc)                 (gconstpointer a,
gconstpointer b);

Specifies the type of a comparison function used to compare two values. The function should return a negative integer if the first value comes before the second, 0 if they are equal, or a positive integer if the first value comes after the second.

a : a value.  
b : a value to compare with.  
Returns : negative value if a < b; zero if a = b; positive value if a > b.  
"

GCC is nice but it's been worked on by so many people it's bound to have some good code in it. And they're just now fixing the horrible brokenness of its architecture by redesigning it. a la XFree86. Yes, I'm talking about the 4.0 update. Don't get me wrong, the new GCC architecture will probably suck just as much but what the hey. IT'S OPEN SOURCE AND IT'S GNU AND LIKE RICHARD STALLMAN WROTE IT.

Which brings me to another point: EMACS SUCKS. IT SUCKS IT SUCKS IT SUCKS IT SUCKS. The keystroke combination for save-buffer is like "control-k, wait 4.51 seconds precisely, alt-0875, oh wait look, it crashed, time to redo everything in vi"

Note: the GNU bash man page documentation is all in one SINGLE man page. It's ENORMOUS. Do they actually expect anyone to read it? Seeing as how noone's bothered to implement a man page viewer with searching functions (or at least DOCUMENTED searching functions) that runs on a console.

And I'm off on a tangent here, but Linux distributions seem universally to set up bash so gnu-ls is pretty-color-gnu-ls. What do these people do when their terminals don't speak ANSI?

Also, why did GNU make --argument style arguments? What was wrong with what would later become POSIX-style arguments?

And the much-vaunted Hurd is doing, that's right, nothing for everyone... or is that noone? Whatever the case it's taking EONS to even pick itself out of the primordial ooze, metaphorically speaking.

Update on a GNOME developer: HE'S WRITING A "FREE" CLONE OF DOT NET. I don't think there's any commentary I can add to that other than: turmeric, perhaps you're right.

Actually, that's a pretty good line to sum up my little diary here.

Sponsors

Voxel dot net
o Managed Hosting
o VoxCAST Content Delivery
o Raw Infrastructure

Login

Poll
Which piece of GNU software sucks the most
o Glib 6%
o GTK 6%
o GNOME 12%
o The HURD 25%
o GCC's C++ backend/frontend/whatever they want to call it 0%
o Richard Stallman's robot brain 12%
o omghax is a loser 18%
o CHOOSE THIS OPTION IF YOU DARE, LITTLE CREATURES 18%

Votes: 16
Results | Other Polls

Related Links
o omghax's Diary


Display: Sort:
Glib is retarded and GNU developers are insane | 28 comments (28 topical, editorial, 0 hidden)
typedefs (none / 0) (#1)
by ZorbaTHut on Tue Aug 12, 2003 at 11:28:20 PM EST

I've never understood the "make your code less understandable through typedefs" movement. People say they're designed to make your code *more* readable, or easier to change, but they never know what they're doing. It's the same mentality that writes

const int one = 1;
const int two = 2;

and then uses "one" and "two" instead of 1 and 2. But hey, they're better because they're not magic numbers!

The most idiotic use of typedefs I ever saw was someone who had a type named "mvipvis". Turned out it translated to "map from vector of ints to pair of vector of ints and a string". When asked why he did it, his response was "So I can change it easily later on if I want to!"

So, let me get this straight . . . instead of having a type named "mvipvis" which is a poorly done acronym of its actual type, you'll have a type named "mvipvis" which is a poorly done acronym of the type it *used* to be?

Don't even get me started on open-source software. :P

man & ls (none / 0) (#3)
by R343L on Tue Aug 12, 2003 at 11:55:39 PM EST

> export PAGER=less
> man bash
foo
nnnnkkkkk

That would: set your pager to less (which beats more anyday), loads the man page, finds the fourth occurrence of foo and then goes up five lines (say to see what was before the foo).

This works entirely fine in a console. less has vi/emacs (not really sure of which pieces come from which) style navigation:

  • k, j are up and down as in vi, the up/down arrow keys are the same
  • ^U and ^D are page up/page down, I suppose Page Up Page Down keys might work the same but I never use them, etc.
  • /search<enter> searches for the given text (vi/grep style regular expression), ?search<enter> searches backwards
  • :0<enter> (or I think gg) will take you to the beginning, G will take you to the end.
Those are all that I really know, but they are all I ever need. Now if you had thought to do man more or man less on your linux boxen you would know this.

You can turn off the ls behavior by (depending on your distro): changing the alias for ls in the /etc/profile or changing it in your own .profile (or .bash_profile, or etc for different shells). It's not really that hard. In any case, color ls works fine in my console, though I prefer the -F flag ( after dirs, * after execs, @ after symlinks and | after named pipes).

Oh, wait. IHBT, no?

Rachael
"Like cheese spread over too much cantelope, the people I spoke with liked their shoes." Ctrl-Alt-Del

Quick comments (5.00 / 1) (#4)
by Hot For The Teacher on Tue Aug 12, 2003 at 11:57:39 PM EST

Because I need some sleep.

- GLib is designed for portability, and you can't just assume we live in a perfect world where every compiler is 100% C99 compliant.

- Direct use of malloc/free is not a good idea if you need to frequently allocate and deallocate structures. For starters, malloc/free will end up being a lot slower than the memory chunks and using it frequently may degrade system performance due to RAM fragmentation. I don't think this would be an issue with the GNU C library, but there are other platforms around.

- I fail to see the problem with GHashFunc/GEqualFunc/GCompareFunc/etc. You can't implement generic data structures and associated operations in C without function pointers.

And yes, IHBT.

Regarding man searching... (none / 0) (#5)
by Xoder on Tue Aug 12, 2003 at 11:59:08 PM EST

Since your pager is, more likely than not, less, you can hit forward slash (/) and then type the string you're looking for.

so if I'm looking for if, I would go like this:
$ man bash
/if

To look for the next "if", all I have to do is hit slash and then enter.  To find the previous "if," question mark is used instead.

I thought it was all ass-backwards until I got used to Vim, and now it makes sense.

Of course, my roommate uses Vim as his man pager, so you might want to try that.

YMMV

Lately I've been hearing that god's on our side But rumor has it, there's one on their side too So what I'd like to know is, when it comes down to it, can my god kick their god's ass or what?

totally. (none / 0) (#12)
by rmg on Wed Aug 13, 2003 at 12:56:38 AM EST

glib just makes your code look even more broken than C requires. when you see a void pointer, you should feel like something fucked up is going on... like memory allocation or something. but with gpointers, it's like just another datatype. but it's not. it's a void pointer. the spawn of satan.

glib is just a scam to make gnu stuff seep more deeply into the programmer's code. you have to use glib if you want to port to some toolkit other than gtk, etc, etc.

glib sucks.

_____ intellectual tiddlywinks

Answers (5.00 / 1) (#23)
by it certainly is on Wed Aug 13, 2003 at 05:06:39 AM EST

  1. Homebrew typedefs are just a stylistic thing. No, I don't like them either.
  2. C99? "long time ago"? What are you smoking? C99 compilers only started appearing a few years ago, and they're still not compelled to provide exact sized datatypes, even in C99. glib has been around for a lot longer than C99, and continues to work on all platforms, rather than say "you need a C99 compiler to compile this software".
  3. The compare function is fairly standard -- it's used in qsort().
  4. No, I don't like alloca() either, even if it is very clever by allocating space in the stackframe.
  5. Why do you care about GCC's architecture unless you're writing for it? As long as it works as a C/C++/Fortran compiler, I'm happy.
  6. save buffer is control x s. Possibly the easiest shortcut there is.
  7. All shells have huge manual pages. It's why GNU use the info format, it's a proper documentation viewer.
  8. You can search in manual pages with the slash key '/'.
  9. If your terminal doesn't speak ANSI, ls --color will print whatever is used on that terminal for colour, or give up and print plain. Why do Linux distributions do it? Because they assume that most people installing a fresh Linux install will be using the Linux console or xterm or rxvt or kterm or gnome terminal, i.e. any terminal on the same box, all of which understand the colour control codes. It looks far better, and linux newbies don't have to change anything to get it. If you're going to be a hyperintelligent sysadmin dude, just change the global profile so it has no dircolors or alias ls in it.
  10. POSIX style arguments (one character flags) are harder to memorise than a mnemonic word. GNU programs can use both, I don't see why you'd complain.


kur0shin.org -- it certainly is

Godwin's law [...] is impossible to violate except with an infinitely long thread that doesn't mention nazis.

Glib is retarded and GNU developers are insane | 28 comments (28 topical, 0 editorial, 0 hidden)
Display: Sort:

kuro5hin.org

[XML]
All trademarks and copyrights on this page are owned by their respective companies. The Rest © 2000 - Present Kuro5hin.org Inc.
See our legalese page for copyright policies. Please also read our Privacy Policy.
Kuro5hin.org is powered by Free Software, including Apache, Perl, and Linux, The Scoop Engine that runs this site is freely available, under the terms of the GPL.
Need some help? Email help@kuro5hin.org.
My heart's the long stairs.

Powered by Scoop create account | help/FAQ | mission | links | search | IRC | YOU choose the stories!