Showing posts with label Programming. Show all posts
Showing posts with label Programming. Show all posts

Thursday, September 20, 2012

When is a variable?

When it's not initialized of course!

I spent hours tracing an access violation which appeared in my code with no sane explanation.

Long story short it took a lot of output to stderr before I nailed it because there were no compiler warnings and where it was crashing was a library call.

I inadvertently discovered how to initialize a variable without initializing it. Cutting through the specifics I had the equivalent of a C char*. I had managed to forget to initialize it. "No compiler warning?" Well that's the fun part.
See this char* string existed as a temp variable to do some filename parsing on so I could autoload related resources. I was concatenating to this string. This uninitialized string. The concatenation was initializing it... but wasn't. What I think it was doing was trying to add my text on after the first nul it found in memory. Whoops!

I feel rather happy that it at least crashed the program. Otherwise that is a hell of a timebomb to have sitting around in code.

Tuesday, September 11, 2012

Ideas into reality, or wrapping something in an idea?

Over the past few weeks my toy project has been a simple tiling game engine. The thing is I don't know what direction I want to take it in. It's acute Indie-itis. Still it's better than the next layer back which is "I have a great idea for a game, will you make it for me?"-osis, which is a far more chronic ailment.

When it comes to having an idea, documenting it and realizing it, I can do all three. But this time around it's a poorly fleshed out concept for an engine for actualizing ideas. Still need to see if I can compile it using the JVM too. Thinking about it from a code protection POV it's also rather brilliant. Current tools allow anyone with a few spare neurons to decompile Java. But what if the bytecode wasn't generated from javac in the first place? I'm just about 100% sure that it couldn't be decompiled easily enough for the average 1337 h/\xX0R to bother with. Besides, if I flesh out a few more layers it just may support those files which smell of eggs that web2.0 things like so much.

New tablet kernel just finished downloading. Time to try it! Bye.