Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe
you got chatgpt or something to write all that right? If you sat down and wrote that yourself for the sake of making a joke in the computer programming thread then either you're crazy or i am.

Adbot
ADBOT LOVES YOU

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

Breetai posted:

(e.g. it's a historical data store)

you mean i.e. not e.g.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

Soricidus posted:

The problem with it is that having a case statement in the middle of a loop is the kind of thing that might plausibly be undefined behavior or a compiler-specific extension. It’s obvious what the code intends to do, but it’s not a common idiom, so unless you’re familiar with the trick, it’s not obvious whether it will actually do that reliably, even if you run it and it seems to work on your machine.

That’s why it’s bad code.

I was going to say that it should be ok because no initialization of variables was being skipped, but actually it potentially is if I understand correctly.

The initialization of i to 0 occurs in the for loop header and it ought to run because the state is initialized to "at start" - but having said that, all the properties are public, so the user could construct one of these, then change the state and then call resume() to get it to run without i being initialized? But you could fix that by just initializing i to 0 along with all the other members so I don't know why the author didn't just do that.

Even if the enum member was (say) made private so that you couldn't do that, it seems like it's asking a lot of the compiler to prove that i isn't accessed before it's initialized? You would think the compiler would warn about it.

I guess in C++ both the "switch" and "for loop" language features translate pretty directly to labels and gotos, and it's clear how you convert that code into labels and gotos and it shouldn't cause any problems, so other than the uninitialized variable thing, I don't know how plausible it really is that it would be undefined.

It's a while since I touched C++.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

RPATDO_LAMD posted:

"this is bad because if you gently caress with internal object state you can put it in an invalid state" is a very "you're holding it wrong" kind of problem to have

It's not internal object state though, it's public. The language gives you the tools to make it internal, but the author of this code neglected to do that.

It's not like Python where everything is based on conventions and promises. If something is left public in C++ then the user is entitled to suppose that that means you intended for them to be able to modify it.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

darthbob88 posted:

The thesis of the presentation at time of posting is mostly this koan, plus leaky abstractions and possibly this XKCD. "Magic abstractions are very useful, but they will trip you up if you don't know about them and a little about what they do under the hood".

It's early and I will probably think of more interesting examples when I've had some coffee, but how about : string concatenation in languages like C# where strings are immutable? The language seems to promise that you can just go around using += to build your big string. But once you understand a little about what's happening under the hood, you know enough to realise when you actually shouldn't do that.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe
What's his goal (if there is any coherent goal)? Reproducibility of builds is a very good thing and if there is variation in people's setup then it potentially works against that. It is best controlled by having a known standard (e.g. a dedicated build server whose configuration is documented and stable) rather than by being obsessive over controlling everyone's workspace though. Or is he just on the warpath because he's decided the current way of doing things is inefficient? (in which case he should be able to produce evidence to support that contention)

Adbot
ADBOT LOVES YOU

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe
basically what business problem is he trying to solve and what's his evidence that (1) it's a problem and (2) his activities are a good way to solve it

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply