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
Flownerous
Apr 16, 2012
How else are you going to debug auto-increment?

Adbot
ADBOT LOVES YOU

Flownerous
Apr 16, 2012

Vanadium posted:

How does all of this interact with taking a char* pointer to the beginning of a large struct and then accessing it byte for byte? :allears:

Yeah does the type of the pointer change things? Or is it well-defined as long as you stay within the struct or 1 past the end, regardless of the type of the pointer?

Flownerous
Apr 16, 2012
Is that just a timing thing? It could change between the call and the access?

Flownerous
Apr 16, 2012

leper khan posted:

if (!(foo > 0)) {
..
}

int or float? I use that form if it's a float and I want to catch NaN too. Maybe I'm the horror?

Flownerous
Apr 16, 2012
Style rules and appropriate collection type for purpose are two different issues.

If you're looking to perform a variety of queries on a data-set large enough that searching through all the elements is a performance problem then Dictionary is the wrong collection type.

If a Dictionary<Year, Dictionary<Month, Data>> is the appropriate collection type then it comes down to a trade-off between the boilerplate necessary to do it stylishly and the benefits.

Flownerous
Apr 16, 2012
Yeah that's pretty typical for a game character class in any game let alone an RPG. You can bet each function in that class ended up reading from and writing to many aspects of the character, and that those rules were probably changing every day during the pre-production phase when they were experimenting with how the game would play.

Sometimes you get a chance to go back and refactor out anything that can be, but that's rare when there are bugs that will actually impact consumers to fix.

Flownerous
Apr 16, 2012
Yeah just narc on your classmates, you dummies. How could that possibly backfire?

Adbot
ADBOT LOVES YOU

Flownerous
Apr 16, 2012
For practical purposes, char is just C/C++'s name for byte. I think sizeof(char) == 1 is in the spec.

And yeah it's nice for there to be a contract that T* points to a valid T in memory as long as you don't do anything undefined.

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