/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?
//ArchVect.a = No of stored elements
//ArchVect.l = No allocated
//ArchVect->gVect[i].d = element i
Name:
root@eecs.berkeley.edu2011-09-16 22:27
>>45
No. That totally sucks. Leave the programming to the legit engineers you fucking wanna be nigger.
Name:
root@eecs.berkeley.edu2011-09-16 22:30
>>44 Will store number of elements allocated / stored in every element of the vector?
Nothing is getting stored yet because the program never completed the translation unit. Once it does, the whole thing becomes a declaration. I would say go read the ANSI/ISO C standard, but I don't think you have the mental capacity for such terse reading.
Name:
n3n7i2011-09-16 22:53
...Unless you're doing something tricky with the **void?
...you probably could've explained it by now if you weren't groaning so much..
Name:
n3n7i 2011-09-16 22:56
The only reason why I'm here on a friday night, instead of going out, is that I'm a total loser in real life. I'm also broke because I got fired from nambla.org