Insufficiently Advanced Technology

22 May 2013 16:00

$ git push origin slashslashslash

3 notes

+ 15:39

I just ran diff -r on two directories, greped the filenames that differed, used awk to generate some python snippets to load the files and then made the lxml package generate html diffs and inserted some css afterwards. I should really just learn python at this point.

4 notes

+ 14:59

rust owns because use-after-free stuff is detected at compile-time

rust is also terrible because if use-after-free stuff is suspected at compile time you better have a compelling argument for why it’s actually ok

+ 14:58

420official:

slashnull:

insufficientlyadvanced:

I need a better IDE than spawning a dozen xterms with vim in them + one to type “make” in

Do you use vsplit and ctags?

If you do so and still need a better way to navigate code, I can’t do anything for you.

the answer you’re looking for is “emacs”

tumblr, i’m terminating your consulting contract right here

12 notes

+ 14:56

Basically the worst thing about undefined behavior is that it’s also not defined that it has to crash, so people are all “but it worked all this time!!” once diagnostics and static analysis or w/e catch it, or someone tracks it down.

+ 14:55

kr-studios:

This shouldn’t work, because a different compiler would interpret it differently, and create garbage values. You should never create code so ambiguous that even different compilers have trouble interpreting it; that’s why they created the move constructors in C++11 after all.

Specifically it shouldn’t work because nowhere in the standard does it say that the first field in the struct gets initialized before the second field of the initializer gets evaluated and can read that value back out, therefore it is reading an indeterminate value, therefore it is undefined behavior.

At that point the compiler is within its rights to throw its hand up and generate whatever code it wants, including things like the whole function doing nothing, crashing loudly, data corruption, etc. The point of that sort of liberty for the compiler is basically that the standard can mark things that you don’t get to rely on, so that the compiler doesn’t have to go out of its way to implement it “predictably”, so that ultimately you get faster machine code out of it at the cost of restricting what code is legit to put in.

Basically people get the impression that C/C++ is really free-form because the compiler lets them do wtf but then it turns out that you have to be fairly well-behaved if you want the compiler to not trick you and give you broken code and then everybody acts all surprised when their “this could NEVER crash!” code stops working once compiler optimizations improve.

Check out the series at http://blog.llvm.org/2011/05/what-every-c-programmer-should-know.html and maybe http://blog.regehr.org/archives/918

43 notes

+ 14:02

slashnull:

insufficientlyadvanced:

I need a better IDE than spawning a dozen xterms with vim in them + one to type “make” in

Do you use vsplit and ctags?

If you do so and still need a better way to navigate code, I can’t do anything for you.

I’m so stuck in my ways of using my touchpad to switch focus between windows and don’t really want in-terminal fake windows, though. If only they wouldn’t build up and hide behind unrelated browser windows all the time.

I haven’t used ctags, don’t tell anyone. :(

12 notes

+ 13:43

I need a better IDE than spawning a dozen xterms with vim in them + one to type “make” in

12 notes

+ 12:58

c-kvey:

On tumblr, yeah, definitely not. I feel like too much of the discussions on here come from people still learning simply due to the demographic target and the fact there’s a heavy leaning towards indie game development. Either way the occasional statement towards expressive and easy to debug code is usually appreciated I guess.

I did mean in general. I dunno, I picked up most of my C++ from misunderstanding a few books, lurking on irc and eventually trying to confirm my preconceptions from reading the standard once C++ had succeeded in sucking the soul out of me. I haven’t really seen anyone wholeheartedly recommend anything, the most confident was a guy who said he just read the standard until he “got” it which is not a fate I wish on anyone.

I’m definitely ~still learning~. Calling myself a hobbyist programmer would be flattering, and for the longest time I found learning a lot more rewarding than actually building things, which I guess doesn’t bode well for any sort of professional efforts.

(Source: kr-studios)

43 notes

+ 12:50

ghostlythings:

Most novice C/C++ programmers know better than to even attempt to read an uninitialized variable - especially in the middle of it’s own declaration. That’s usually taught in Programming 1 as a “do not ever do this, even if it lets you”. 

Yeah, sure. So someone comes to the same conclusion outside of a Programming 1 class and that’s somehow bad? I dunno what the guy’s background there is, I guess maybe he should have known already, w/e.

The only - and I do mean only - reason his code compiles clean is because C++ initializes everything inside an object to zero automatically. Hence, there is no such thing as an uninitialized variable inside an object. This is one of the major differences between C and C++ - and why this doesn’t throw off warnings in C++.

This is pretty much wrong. Also clang throws warnings.

However, this means that his test case is fundamentally broken. Since he uses zeros as his base values, his demo code doesn’t actually show if it is actually reading the value from the object as it’s initializing the same object (as he asserts), or if the compiler decided to protect him from himself and is reading from the (now stale) version that was initialized automatically.

It turns out the undefined behavior manifests as he asserts in this case. If you’re sure the struct members get initialized with zeroes before the undefined initalization happens, `Rect r = {1, r.l + 10, 2, r.t + 10};` prints 1, 11, 2, 12 (on my machine, certain phase of the moon, yadda yadda).

As the C++ language specification doesn’t specify how an object is to be initialized, this is actually an interesting question.

But that’s not what happened. He wrote a whole chunk of code that he thought he understood and demonstrated what he intended. This is basically a textbook example of trying to be clever with code and utterly failing in the process. Which is, of course, what often happens when you try to do that.

It’s trying to be clever insofar as it’s trying to empirically understand undefined behavior which is almost by definition fruitless unless you’re trying to understand the failure modes of your presumed-buggy code. You’re calling it an interesting question, he tried to work towards an answer, maybe he fell short, maybe he should have chosen the bible study approach of grepping the standard for “sequenced before” and concluding it’s not, or maybe he should just have not given a fuck and done something else, w/e.

It’s really fucking unsatisfying to go from trying to see if stuff works and getting concrete feedback from your program to making vague arguments in reference to a huge legalese document to yourself, I’m just gonna blame this on C++ and be sympathetic towards the effort.

I don’t wanna respond in detail to the rest of your post, you have the industry experience and I won’t argue with that. I agree that he’s got unrealistic expectations and is unprepared for serious business industry programming, I just don’t think you’re actually motivating him to learn more by hitting him over the head with how he needs to learn more and should feel bad for posting code.

(Source: kr-studios)

43 notes

+ 11:51

c-kvey:

Just wondering what you’ve been up to in Rust.

So far I’ve just go some terrible toy programs making sure I understand what I’m getting from the docs and from listening in their irc, and a handful of documentation fix commits in their repository. I keep running into odd roadblocks where some super-elegant planned feature isn’t 100% implemented yet and it seems to work fine in everybody else’s code and trigger internal compiler errors in my code, and there’s someone blogging about revamping it completely, so maybe I better hold out for a bit more??

I want to hack on the compiler at some point but I don’t really have the expertise or any serious programming background really. I totally want to fix at least how doc-comments work really soon though!!

I’ve discussed it with a few people and we used it for a few Tecate wednesdays when I was at a past company. At the time it was sort of a pain setting up initially (shit that doesn’t matter at all) due to time to setup the compiler in a time-limited situation haha.

Tell me about it, for the past month or so I somehow managed to make it build llvm without any optimizations or something by having a messed up environment, so I didn’t only end up with a 5 GiB build dir, every recompile also took 90 minutes.

I really enjoy the ideas it establishes and it’s implementation of some sense of actor model as it gets more and more popular to do so.

The model it has when it comes to single machine performance makes a lot of sense, so Servo makes total sense for it, or games etc - my personal focus is more on multi-machine on my own time right now though so it’s not as ideal.

I think towards the beginning they had more of a thread/process/???-agnostic concurrency model sketched out, but I guess it didn’t materialize as such.

(Also attaching this given I’m not sure a better way of pinging you: Your blog looks interesting and it’s one of those ones I’ll need to read through when I decide I have time to do something like that.)

It’s probably 80% passive-aggressive sniping at random people on and off tumblr at this point and only loses focus as you go back, don’t expect too much…

(Source: insufficientlyadvanced)

4 notes

+ 11:39

c-kvey:

The case of communicating with others while including the perception you have of others is a strange one, wherein it is both necessary and bad to do so.

I can totally see this being helpful, like, I often see people talk past each other because they try to guess the other poster’s level of expertise instead of being like “Hi, cool that you’re interested in my project, I assume you haven’t worked with ______-style stuff before and/or what’s your background and/or what kind of advice are you looking for”, or see someone burst into a community coming from somewhere with a completely different kind of etiquette, being kinda inappropriate and weird and whatnot yet getting responded to politely and neutrally or just ignored, until someone has had enough and they get banned.

I mean, completely hiding your perception of someone you’re interacting with is also dishonest to the point of being counterproductive sometimes.

And tumblr doesn’t need to be a 100% professional environment and I enjoy reading snarky programming blogposts as much as the next wannabe-snarky-asshole, but directly engaging someone being all dismissal and no substance is kinda pointless.

I think the ideal advice in this case would’ve instead to have just been for anyone to have linked references and examples rather than degenerating into opinion pieces of the methods involved.

It’s arguably kinda hard to find good reference material about that sort of thing, most C++ stuff I’ve seen is either beginner-level stuff where they’re basically happy if the reader can get something to compile or completely esoterically advanced bullshit where the assumption is that anyone who can’t cite the strict aliasing rules before breakfast wouldn’t be reading that article anywhere. Or I guess weirdly specific stackoverflow-style questions where someone has some code that compiles and someone else posts fifteen narrow citations from the standard why it’s not allowed anyway and all the first person can take away from that is “well don’t do that then”.

There doesn’t seem to be a lot of, I dunno, pragmatic deconstructions of why precisely bad code is bad and how to not write bad code, other than an “I know it when I see it” attitude and some general bad feelings when seeing weird pointer stuff. I guess it doesn’t help that the lingo that the standard and more ~advanced~ C++ programmers use has basically nothing in common with the vocabulary of more accessible texts.

Though the actual socialization about coding, even if it goes bad sometimes, is actually super appreciated by me as a third party. These conversations you all have are really quite fun to read just for the sake of seeing a few people be human about coding.

I wouldn’t get so worked up over this if it didn’t come across as the complete opposite of socialization to me. If I was the dude with the questionable C++ code, I’d just have silently packed up and tried to find another place where I’d actually get something constructive out of posting my code instead of just “you’re what’s wrong with C++”-style reactions, justified by my code or not. Best case, someone is just gonna stop talking about their code for good, silently churning out LoseThos 2.0 or jealously hiding their source code for fear of it not being polished enough to show to anyone “yet”.

(Source: kr-studios)

43 notes

+ 11:10

dataanxiety replied to your post: google graydon hoare

insufficientlyadvanced:

google graydon hoare

I did. He developed Rust, a lower-level programming language, works for Mozilla, is 40+ yrs old. He says that Mozilla has a bad (or non-existent) policy re employee harassment, is that the gist? What’s up with that?

I didn’t know how old he is but my points were basically that he’s working with a team developing a programming language that’s sorta aimed at the upper end of what people use C++ for with a really strict focus on memory safety, where the compiler is a lot stricter than your typical C++ compiler and dangling pointers and uninitialized values are basically unthinkable without the moral equivalent of reinterpret_cast (and/or compiler bugs, which are as of yet plenty, unfortunately), so This Wouldn’t Have Happened, and coincidentally that he’s managed to create a community for that language that has a total zero tolerance attitude towards pointless confrontational bullshit and unproductive derailing and is exceedingly helpful, so This Wouldn’t Have Happened there either.

4 notes

+ 10:58

ghostlythings:

insufficientlyadvanced:

lol what is even your problem.

  1. Spending the last year having to clean up after people who should know better, yet write code like this and then check it into a repo.
  2. Spending the last year having to deal with people who were way too coddled during their undergrad years, and consequently are lazy and don’t want to put any effort into developing their own skills.
  3. Spending the last year trying to help people learn these kinds of nuances, with people often just looking for an answer handed to them instead of trying to learn it.
  4. Law students.

Take your pick.

So your solution to people not knowing what the fuck and checking in bad code is to try to frighten them out of trying to learn what the fuck and into keeping their code secret because their code isn’t production quality yet until they are forced to push it into your repos anyway + conditioning them that talking to what passes for their peers about their code and what they’re learning is only gonna lead to ridicule and being dismissive.

I mean I guess you aren’t obligated to be conductive towards anyone’s programming career, and I’m certainly not the expect for that sort of thing around here, but it really feels like this is going to backfire.

(Source: kr-studios)

43 notes

+ 10:02

also if some dude’s initialization fuckups is the single stupidest thing you’ve seen all year, i’ve got a metaprogramming fizzbuzz bridge to sell you

2 notes

Page 1 of 104