Jeff Preshing

Jeff Preshing

60p

200 comments posted · 0 followers · following 0

23 hours ago @ Preshing on Programming - A Primitive Reflection... · 1 reply · +1 points

But you still repeat the names of the fields: on line 20. Cool example though.

1 day ago @ Preshing on Programming - Memory Reordering Caug... · 1 reply · +1 points

Hi Szilárd,

You are right: According to the rules of modern C++, this example is considered to have a "data race" on both X and Y. When I wrote this post, C++11 compilers were still uncommon (at least in the game industry).

It doesn't matter, though. In this post, we're not just reasoning about things at the C++ language level. We're looking at the generated x86 code and reasoning about program behavior at the machine level... long after the C++ compiler is out of the picture! At the machine level, we can rely on guarantees provided by Intel. (Specifically, Intel guarantees that all natively-aligned 32-bit MOV instructions are atomic.)

1 day ago @ Preshing on Programming - A Primitive Reflection... · 3 replies · +1 points

Yeah, that's always been the problem with macro-based systems. The advantage is they're easy to integrate. I've been hit by those silent errors, but it hasn't been *that* much of a maintenance burden. Mistakes are easy enough to discover and fix. Still, I'm about to add reflection to a whole bunch of classes that don't currently use it, so I'll likely implement a build script that generates the macros in a way that keeps things in sync.

For your second suggestion, doesn't that just move the boilerplate from the macros to a function? The nice thing about macros is you can use the stringify # token.

1 week ago @ Preshing on Programming - Acquire and Release Fe... · 0 replies · +1 points

I gave this analogy as a way of thinking about correctness, not speed. On a normal multicore CPU, I don't think you'd ever observe memory unpropagated for more than a microsecond (and that's probably being generous).

3 weeks ago @ Preshing on Programming - How to Write Your Own ... · 0 replies · +1 points

No, I hadn't. Thanks! It looks like another good candidate.

3 weeks ago @ Preshing on Programming - How to Write Your Own ... · 0 replies · +1 points

I still use it on Windows because the steps to initialize devices are so complicated there, and SDL simplifies it a lot. I eventually found I didn't have much need on iOS.

4 weeks ago @ Preshing on Programming - How to Write Your Own ... · 1 reply · +1 points

I'm kind of curious about your little data language!

4 weeks ago @ Preshing on Programming - How to Write Your Own ... · 0 replies · +1 points

I started in the industry almost 20 years ago and there are a lot of learning curves (math, 3D graphics, animation, etc.) that I've already gone through. I won't try to kid you, that's a huge advantage, but it's also stuff that can be learned. I've also done a lot of troubleshooting over the years, so when I encounter weird technical problems and bugs, I can usually resolve it quickly. That comes with practice I guess.

4 weeks ago @ Preshing on Programming - How to Write Your Own ... · 1 reply · +1 points

Yep. I can confirm that the opposite approach (taken to an extreme) doesn't work either. This isn't the first engine I ever tried to write. I took a year off between jobs for most of 2001 and made an attempt. My approach back then was not iterative at all. I got sidetracked thinking about far-fetched tools I could write to help with the engine development process. It failed and I ended up with almost nothing to show. In hindsight, it's easy now to see what I did wrong, but at the time I had no idea!

4 weeks ago @ Preshing on Programming - How to Write Your Own ... · 0 replies · +1 points

If you're making a 2D game with SDL, sounds like you've already made an engine!