Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Type agnosticism, data structures and C

Name: Anonymous 2011-09-16 6:07

/prog/, I've been working on a C library with basic data structures and useful functions, and have implemented things like doubly-linked lists and vectors and so on. Now I'm working on Unicode-based string support. Here's my issue.

I've implemented type agnosticism on the vector type using void pointers (not preprocessor macros), so I want to use the vector type to represent a string. Each Unicode codepoint is an int32_t. Of course, I don't want to have to allocate four bytes on the heap for each codepoint, then point to that from each vector element; that's utterly stupid. On the other hand, doing typecasts to shove an integer in the void * type is kludgy and works very poorly, often requiring double explicit casts; once to expand/shrink the type's size, then once more to explicitly cast to a pointer or back.

How can I solve my issues and use my vector type for strings?

Name: Anonymous 2011-09-16 8:03

>>19
Generic data structures are a sign of bad design or Greenspunning. The STL is a cancer.

Good lord look at all the autism in this post!

But let's try to be serious for a moment, assuming that is even possible with complete numbnuts like you around: At the implementation level, std::vector and std::map behave just exactly like containers in the GLib - the STL, however, provides proper reflection, making shit like vec_push_back(&crusty_cum, all_the_autism_in_this_thread, sizeof(crusty_cum)); unnecessary, because C++ is able to detect the size properly. Now go back to your hugbox, you grossly deformed LITHPu GNU/Blob, you.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List