ah, time to settle in and enjoy my favorite bizarre c++ memory errors

I know i have a dangling pointer *somewhere* but now I gotta find it and asan just tells me about the segfault I already knew about

Yep, that was an easy fix.

Would have been easier if I wasn't getting lied to by the debugger, but what're you gonna do

in conclusion, since I know I have people following me who are curious about software and development: 99 percent of the time, if a problem seems resistant to being solved, there's a good chance you're going about it wrong and the answer is obvious and somewhere else
one percent of the time it's some absolute bullshit, though, but don't decide on that until you've ruled everything else out

for example, one time, i was in a group project and folks spent like half the allotted time changing the file, recompiling it, and naming the output "test"
and the dude kept running it just by typing "test" at the command line
and my first thought was "you gotta do ./test so it knows to look in the current directory" and he brushed me off
long story short, turns out he was running the built-in bash test command the whole time and I was right

the moral of the story is: listen to Grace. if she's not around, try examining your assumptions

this is really hard to do, because the point of assumptions is to not have to waste precious brainspace on stuff, but it's an important skill for computering and also in general

Follow

the skill that has served me better than any other, both in the CS world and in general, is the ability to quickly form mental models of a system. that is, the quicker you can develop a feel for what the system is doing under the covers, and the quicker and more accurately you can get your model to approximate reality, the better time you'll have

the coworker I complain about all the time does not do this. he doesn't, like, have a mental model of the computer and what the things he's telling it to do actually mean. He just kinda tries things until they work. No effort to learn about the machine and how to effectively work with it.

this isn't just computering, either. if you take a chemistry class, they'll spend a lot of time talking about molecules and them bumping against each other. For example, if you know that if we say something is hot, it means the molecules are moving faster than average, and you know that reactions happen when two molecules bump each other, do you think more reactions would happen if your mixture was hot or cold?

They want you to form a mental model of what's going on so you can answer questions with critical thinking instead of memorization.

@BestGirlGrace I can attest to this idea, because I have definitely done both the good and the bad thing here.

Complete disinterest in a problem has led me to looking up code snippets and just fumbling around for way too long trying to make the copy-paste work.

But also finally seeing the mental model of a problem and thinking "oh, it's simple. You just..."

@rockario Yep! The copy paste path is the tempting one because it's easy. I think everyone has been stuck in that tarpit before.

I always say "you have to engage your brain at some point."

Sign in to participate in the conversation
Princess Grace's Space Base Place

Don't let the name fool you. All the pornography here is legal, and much of it is hand-written. No fascists, no bigots.