|
World Cup Mystic Meg So: As cannot have been escaped, The World Cup Of All Things Football is finally upon us. The newspapers and magazines are full of players, pundits and pop stars vomiting forth their ill-informed opinions on who will win what and how each team will fare. Well, we're just as good as their kind of scum, so there's nothing preventing us doing it, too. Post your predictions below, so that, in five weeks time, we can all have a good chuckle about how ludicrously off-the-ball we all were. Predictions can range over anything you like (commentators having coronaries, tourist attacks, most disgraceful fans etc.), but should at least include a guess at who the overall winners will be, plus an estimation of how your home nation will fare (Rogerborg and gpig caveat: if they qualified). Nobody likes sticking their neck out, so I'll get this ball rolling:
The indentation chestnut Coders often love to argue about indentation and brace styles - indeed, some people here may have bones to pick over the way I formatted some of the code in the next section, especially the many-parametered function calls. Code style is one of those things everyone has a preference over but, in reality, most hackers can happily read most styles, so don't really care that much. An indentation style is nothing more than a way of formatting code layout, to reflect scope and structure. It is usually expessed most through the positions of the braces ('{' and '}'), and the indentation. If given the choice, I tend to use what's known as K&R style (aka OneTrueBrace style). It looks like this: if (conditional) { A lot of the code I see uses the so-called Allman style (aka BSD style), like so: if (conditional) In truth, there isn't a vast amount of difference between these two styles - just the location of the opening brace - and you can often see people using combinations of the two. For instance, in what I call 'Stroustrup style', people use K&R for conditionals and loops, but Allman style for functions and methods. Some of the more esoteric ones I'd come across include Whitesmith's style: if (conditional) and GNU style, which is kind of a half-way house between Allman and Whitesmith's: if (conditional) There are various rationalizations for criteria which cover style, including vertical space conservation, code scope determination, semantic connotations of code placement etc. Until this morning, I had never come across the following style in my day-to-day work, but now I have: if (conditional) { According to wikipedia, it's called 'Banner Style', maybe because Bruce came up with it when he was cross. It's a travesty. Yeah, it looks innocuous enough there, but imagine how it looks with nested loops and conditionals. Even something not-very-complicated gives completely the wrong impression: for(i = 0; i < foo; ++i) { Completely. Bloody. Useless.
Perls in the C Just how do you check for the existence of needle and retrieve it from "Haystackhaystackneedlehaystackhaystack" (where needle may itself be a regular expression and hence not amenable to a straight substring search)?
Doing it with Perl
Doing it with C in one of the most terse but legal ways possible (avoiding dynamic allocation and all things malloc)
Obvious lesson for today: If you can use perl for text processing, do use it.
|