« Older and Wisern't | Main | Supermarket Software »

US Torture Bill as C code

WARNING: GEEK ALERT

if (person = terrorist) {
            punish_severely();
} else {
            exit(-1);
}
Can you spot the error?

[stolen from via BoingBoing]

Comments

I don't know C, really.
Does the US Torture Bill return errors of:
variable 'terrorist' not defined?

Just got it (d'oh!).

I notice also that punish_severely() takes no arguments, presumably punishing globals, so to speak.

There was only ever going to be one or two people who could possibly comment on this post (apart from Babs, maybe, with her usual "nerd alert!"), and you are TOTALLY one of them QE, nice one!

Yes, there are no arguments to punish_severely(). I take this to mean that if you're defined as a terrorist, there's no defense.

Hence the unlimited detention period with no trial, in Cuba, etc.

I don't get it, and NERD alert ahoy!! :P

Like, as I said. :-)

Erm... did you mean to use the assignment operator '=' or should that have been the equality operator, '==' ???

In this case 'terrorist' will be assigned to 'person' and (provided the result is non-zero) the condition returned as true. This will effectively label all persons as terrorists...

Ok, so I just read the link to the source article... apologies as I have just repeated what they say over there. Oopsies.

Oopsies indeed!

As you say:

(person = terrorist)

Is the error, as it doesn't follow the 'if' argument.

(person == terrorist)

Will only return true if the person really is a terrorist. Using the single "=" assigns ALL persons to be terrorists, which amounts, in simple English, to "guilty until proven innocent".

Or like, something. It's all Greek to me. But I still kinda get it.

Yep, I had to comment.

Going back to geek mode for a moment (like I ever leave...): 'person = terrorist' doesn't label everyone a terrorist, it replaces each person with a terrorist, losing all knowledge of the person they previously were.

Which may be exactly the kind of reaction the bill will get...

So now that you can read code you can start doing your own html fixes.
:)

Telling the difference between = and == does not does not imply that I 'can read code'. Besides, I thought this here blog was coded in php?! :-P

Dude, I'm tryin'. Doin' my best.

Come on, if you can complain about my 'deprecated' tags (which aren't, by the way, they just won't be in the core when the spec goes modular) then you can learn HTML, then PHP.

Find a project ;-)

Err... I believe Lifewithouttoast.com IS my 'project'.

I don't work with IT/computers/internet/anything, it's just a hobby, so I can only learn it if and when I have the time or the inclination.

Admittedly, having LWT as a project gives me ample inclination, so now it's just a case of having the time. Which I only do occasionally.

Someday, I will know all I need to know. Until then, err... Help?

To be honest, it's not even going to get as far as the incorrect use of the assignment operator. There's no preprocessing directive, no function definition and no variable declaration. For all we know, person and terrorist may be incompatible data types and you'd need to 'cast' the 'terrorist' variable.

There's a disappointing lack of Hungarian notation too but that wouldn't necessarily stop it compiling.

Err... Yes! I'm in total agreement. But then again, it's only a snippet, and even at that, it's only a parody of a snippet.

This post is serving well to root out the true geeks among our readership here on the LWT, I have to say!

If we're trying to root out the geeks, I think Dragon just won a prize or something.

But then we should probably cut some slack for people who need (or have needed) to know this stuff professionally. Did I hear someone say they 'don't work with IT/computers/internet/anything'?

That would be me. It's a hobby. I use computers in work, for emailing, spreadsheets, stuff like that, but not for knowing the nuts and bolts and innards and guts of them. That bit is purely a hobby.

Dragon totally just won a prize. :-)

I only ever learnt C and C++ so that I could hack the pak files in Quake 3/Doom 3 and make my noob pistol deal out 1000+ damage per shot or something

You still win a prize though. :-)

Mind you it will probably be a "prize", like the one offered on the podcast.

Post a comment

JavaScript must be on.

Note you need JavaScript turned on to comment. Sorry but this is the only way we can stop the dirty filthy spammers.

You can send me an email if you are having problems.

TrackBack

TrackBack URL for this entry:
http://mt4.sevitz.net/mt-tb.cgi/2395

This blog looks totally, utterly pants in Internet Explorer. So stop making excuses and download Firefox (or even Opera or Safari) right now (unless you already have).

The Map (for newbies/stalkers)

The Twitters

    mattverso

    ( )

The Flick'red

The Stuff Wot People Said

  • Matt: I was going to suggest you Google it, but then I Googled it, and this post is at #2 on Google for "E...>>
  • Babs: What is eventech when it is at home Great pic btw! ...>>
  • Kristina: I was peeling garlic today and found several cloves that look like this. Very weird. As long as th...>>
  • Babs: I know, it's great!...>>
  • TUG: Misleading thread title of the year!...>>
  • Babs: Oh really O'Reilly, well there'd better be!! ...>>
  • Matt: The garden I WILL have, behind my house, when I have an actual house that isn't a "dooplex". In o...>>
  • Babs: Ahem...what garden? :)...>>
  • Babs: Me too kind of. It's just mildly a pain in the arse at times. ...>>
  • NKV: I wouldnt even allow that in the garden shed. :-P...>>
  • Matt: Personally, I'm liking the bangs....>>
  • Babs: Aren't they just!? I was looking at them for three months while I was travelling around Australia, a...>>

The Linkery Dumpage

I Am Deliciousness

The Crap

Irish Blogs Irish Bloggers Dublin Blogs Blog Directory - Blogged Opera Mini no-www.org DRM is DefectiveByDesign

The Email Thingy

Life Without Toast At G-mail Dot Com (or something similar)

The Hyperspace Drive

The Automatic Geek System

  • Geek Support, fixing of bugger-ups, moral support, code splicing, tech. administration, whining, über-nerdery and fetching of fluffy coffees by
  • s e v i t z d o t c o m, PIA, PHP, CBATG.

The Copyright

Creative Commons License
This weblog is licensed under a Creative Commons License. Please don't steal my/our stuff. Or if you are going to use our stuff, please link back or credit us. If you don't you are VERY NAUGHTY and will have to be PUNISHED.