The Abominable Amalgam

Started by
5 comments, last by Glass_Knife 9 years, 5 months ago
I just wrote a tiny side-project thingy that used all of the following in one program:
  • Code compilation via libclang
  • Execution of generated code in-process
  • Dynamic link libraries invoked via parsing a string
  • Coroutines (Win32 fiber API)
  • longjmp
  • TerminateThread()
  • Thread-local attributes on static class members
  • A shitload of void*
I'm sure there's other terrible things in there. I just needed a confessional to get it off my chest.



I am an awful programmer.

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

Advertisement
I would consider point 1 a good thing, much better to use an existing, well tested library instead of rolling your own. Number 2 isn't necessarily a bad thing as long as you have control over the input. Also coroitines are just too useful not to use. Though win32 fibers wouldn't be my first choice
  • longjmp

That is the only one that scares me on that list. Several of those other bits of functionality are occasionally seen in scripting systems that support in-place reloading and dynamic compilation of scripts.

What bit of functionality required setjmp/longjmp? Over the past few years I've only seen it used as an emergency abort when exceptions were disabled.

setjmp and longjmp are also sometimes used for implementing exceptions in C++ compilers.

Was your "small sideproject thingy" at all related to your compiler development for your Epoch language?

For the record: you're likely to use longjmp if you're using libpng, and use void* if you're using a C library that has callbacks (since user data is nearly always passed using void*). So in that sense those two don't seem really scary to me.

Though the lack of goto in that list worries me.

Don't pay much attention to "the hedgehog" in my nick, it's just because "Sik" was already taken =/ By the way, Sik is pronounced like seek, not like sick.

But did you have any GatewayFactoryAdapterSingletons?


Thread-local attributes on static class members

This is the one that scares me. I use a Java library that traps System.out in a TreadLocal. Sometimes the console is taken over.

I think, therefore I am. I think? - "George Carlin"
My Website: Indie Game Programming

My Twitter: https://twitter.com/indieprogram

My Book: http://amzn.com/1305076532

This topic is closed to new replies.

Advertisement