Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 31 Jan 2009
Offline Last Active Private

#5301641 When you realize how dumb a bug is...

Posted by Sik_the_hedgehog on 20 July 2016 - 05:07 PM

C++ allows overriding your parent's privates.

I'm having a hard time reading this with a straight face.

#5301506 Why didn't somebody tell me?

Posted by Sik_the_hedgehog on 20 July 2016 - 05:24 AM

The bbq in omgwtfbbq stands for "be back quick", not for "barbacue". Apparently I ruined the day for several people already by revealing this.

#5301504 When you realize how dumb a bug is...

Posted by Sik_the_hedgehog on 20 July 2016 - 05:18 AM

Wasted an entire day wondering why the heck graphics weren't being loaded. I examine RAM, the data is there. I look at the code in a debugger and it's indeed executing in the subroutines it should. I look at the code that sends the commands to the video hardware, pointers are OK, then I step and the loop is running, yet somehow the video hardware is ignoring them... wait a second, did an instruction just get misassembled?



cmp.l a4, a5


cmpm.l (a4)+, (a5)+

Huuuuh not only it got converted to the wrong instruction (CMPM instead of CMPA), where did the assembler get the idea of adding postincrement?

#5296198 Why didn't somebody tell me?

Posted by Sik_the_hedgehog on 12 June 2016 - 05:34 AM


Is this some GNU extension or actually part of the standard? o_O


EDIT: it's in C99, but not C++... https://gcc.gnu.org/onlinedocs/gcc-3.3/gcc/Designated-Inits.html

#5293109 Some people just want to watch the world burn

Posted by Sik_the_hedgehog on 23 May 2016 - 02:38 PM

I'm open to hearing about why it's insidious, but have yet to hear a good reason.

That the -> operator is actually a thing and I had to stop and think to figure out how it was supposed to be parsed (because I kept seeing - -> instead of -- >). You definitely don't want to slow down people like that, especially not during crunch period. (and yes, this is all a matter of where whitespace goes, the operation itself is fine)


Also I can attest to the string thing, I swear. I reduced loading times from 4-5 seconds to a fraction of a second just by computing a "quickhash" of each string (just add every character) when the list was first generated, then when it searched for a string it'd compare the quickhash first. Turns out that a lot of filenames differed only in their suffix (e.g. run_1, run_2, run_3, and so on - yeah, talking about animations here). A naïve comparison would have to scan practically the whole strings before failing, but the quickhash made them fail immediately. That the quickhash was stored alongside the pointer (and hence didn't need an extra dereference) probably also helped regarding the cache.


Obviously only useful for things like lists where you compute the quickhash of those strings only once then reuse it over and over, but it's definitely worth it even though it's quite simple to implement.

#5292868 Some people just want to watch the world burn

Posted by Sik_the_hedgehog on 22 May 2016 - 08:55 AM



That's all I'm gonna say.

#5288792 Billborad is not aligned to view

Posted by Sik_the_hedgehog on 26 April 2016 - 12:29 PM

Why are you pushing the matrix when you aren't using it? (and more importantly, you aren't even calling the matrix functions, not using the parenthesis means they're function pointers instead and on their own they do absolutely nothing)


Anyway, I'd argue that probably the easiest way for you would be to rotate (glRotate3f) the billboard the same angle as the camera, but the other way (i.e. -angle instead of angle). Less headaches to cope with. And if you ever switch to a more modern API than the old OpenGL 1.1, remember you can do whatever is the equivalent there.

#5288698 When you realize how dumb a bug is...

Posted by Sik_the_hedgehog on 25 April 2016 - 09:03 PM

Today wondering why a file was 4KB instead of 3KB. Checked the parameters, they were fine. I had just changed the tool not much earlier on the feature that particular file was using so I wondered if I had introduced a bug? But wait, then why the other files relying on that feature aren't broken? Is this one of those subtle bugs?


Then I realized I was looking at the wrong file (ノ_<)

#5288638 GPL wtf?

Posted by Sik_the_hedgehog on 25 April 2016 - 01:14 PM

The biggest problem with copyleft licenses, they usually aren't compatible with each other because they forbid additional restrictions (and copyleft works by imposing restrictions).


That said, to the question in the first post: programs running under Linux don't link to the kernel, they communicate through syscalls, so the GPL is never relevant here.

#5288429 Why didn't somebody tell me?

Posted by Sik_the_hedgehog on 24 April 2016 - 06:36 AM

The existence of this site, period: http://www.regexplained.co.uk/

Basically, enter a regex and it tells you what it does.


EDIT: mother of god what is this regex (and I know that isn't anywhere as bad as the regex for validating e-mail addresses)

#5285839 (sweet!) New Vulkan features just released!

Posted by Sik_the_hedgehog on 08 April 2016 - 10:52 AM

void FillRect(float x1, float y1, float x2, float y2, unsigned color)
   float r = (color >> 24 & 0xFF) / 255.0f;
   float g = (color >> 16 & 0xFF) / 255.0f;
   float b = (color >> 8 & 0xFF) / 255.0f;
   float a = (color & 0xFF) / 255.0f;
   vkPushColor4f(r, g, b, a, nullptr);
   vkPushVertex3f(x1, y1, 0.0f, nullptr);
   vkPushVertex3f(x1, y2, 0.0f, nullptr);
   vkPushVertex3f(x2, y2, 0.0f, nullptr);
   vkPushVertex3f(x1, y1, 0.0f, nullptr);
   vkPushVertex3f(x2, y2, 0.0f, nullptr);
   vkPushVertex3f(x2, y1, 0.0f, nullptr);

For the record, while immediate mode is indeed slow by today's standards =P I wonder how much performance was lost in OpenGL simply by developers insisting on taking control over everything. To me it was pretty obvious the idea was for the driver to figure out the best way to do things (not as hard as it sounds since the driver is specific to the hardware in question anyway, so it can safely make lots of assumptions), but bad implementations certainly hampered that as well =/ Sucks since the driver is the one that knows best, especially on platforms without fixed hardware specs (PCs, anyone?).

#5283838 Fast way to cast int to float!

Posted by Sik_the_hedgehog on 28 March 2016 - 07:24 AM

The sad thing is that fx = ix + 0.0f is actually different from fx = ix unless you're using something like -ffast-math (compilers can't optimize floating point operations because that can introduce different rounding errors and hence technically cause the result to be different, which is not allowed by the standard).

#5283098 When the lawyers come, the coding horror starts...

Posted by Sik_the_hedgehog on 24 March 2016 - 04:37 AM

It's possible they may still have a case (legally) though, since both qualify as software.


Also somebody found a solution to this problem:



Warning: don't be dumb enough to actually use it =P

#5283016 What game is suitable for a beginner to make (with C++)?

Posted by Sik_the_hedgehog on 23 March 2016 - 05:53 PM

Pong is pretty much the most basic beginner game that gets recommended... another venue would be text adventures, though at that point, you are throwing graphics completly out of the window, and your game loop will be quite different (in most cases it will stop waiting for input) than what other games use.

Yeah but it still helps gives you a rough understanding of game states. You just aren't updating it many times per second :P

#5283015 When the lawyers come, the coding horror starts...

Posted by Sik_the_hedgehog on 23 March 2016 - 05:51 PM

Every commercial product I've worked on has gobbled up all the 3rd party code into it's own repo, so it's actually possible to reliably reproduce a bit-exact build of the project as it was at any moment in time.

Or heck, just download the library somewhere (even if just some random directory in a random computer) and work from that (build, make more copies as needed, etc.). In fact I was under the impression this was pretty much the usual way to do things, given how pretty much every library site has some sort of download link. It isn't even high technology, it's what bedroom coders do by necessity.