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

Retarded Idea Time

Name: Anonymous 2010-01-27 6:55

Every so often you get an idea that seems awesome when you're half asleep, but when fully awake seems stupid. Post them ITT

Using regular expressions to parse other data structures (list trees sets etc)

Name: Anonymous 2010-01-28 7:43

>>20
void * is slow as fuck and typeunsafe as fuck.

You are supposed to do the template instantiation by hand: copy&paste the code, then search&replace all type arguments. For the good measure go in there and make some irrelevant unique "optimization" for shits and giggles. That's why it's called "Handcrafted C code".

Alternatives for people who want shit done instead of boasting about the way they spend their lives doing the job of the compiler include: 1) m4 or the like, 2) #define TYPE_NAME list_of_ints\n #define ELEMENT_TYPE int\n #include "list_of_T.inc"\n, 3) stop being a pussy scared by a "slippery slope".

Name: not->>20 2010-01-28 7:57

>>22
It may be unsafe, but how the hell is void * slow? Tt's just a type cast, it does not change what something is compiled to.

Name: Anonymous 2010-01-28 8:41

>>23
For example because of the element_size passed back and forth and used to calculate offsets etc, all at runtime.

And as soon as you want to, say, provide a convenient sort routine for your list, or a custom key comparison function for your treemap, you enter the realm of int (*f)(void * x, void * y).

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