Older blog entries for redi (starting at number 181)

27 May 2009 (updated 27 May 2009 at 14:30 UTC) »

Spam attack! All the accounts certifying pinkurath are the same spammer.

Update: They're gone now, either robogato stepped in or the massed ranks of advogato users saw them off. Nice.

Deleted spammer cupid was trying fairly hard to not look like a spammer (apart from claiming to be a writer and being unable to spell) but a quick google revealed that all the content was stolen from other sites.

Nice try, spammer. Now kill yourself. Seriously.

All spammers and SEO scum should be drowned in a septic tank.

I wonder what percentage of www content consists of SEO diarrhoea stolen from press releases, two-bit research companies and unknown/unread/uninteresting bloggers.

15 May 2009 (updated 15 May 2009 at 12:53 UTC) »
  • Behold, the <future>.

  • L'Enfer, c'est le code des autres.

  • Bullshit overflow detected - MS adds memcpy to the blacklist in their False-Sense-of-Security-Enhanced C library

My new favourite advogato spammer, cupid, says:

I m working on as a Content Writter in a technical website
Good luck with that.

Continuing the C++0x theme to my advogato diaries, I spent last weekend implementing std::nested_exception (n2559, patch) and <future> (n2671 and n2709) for libstdc++. Now that I'm done investigating PRs 40007 and 40027, and fixing 39909 (without breaking the ABI) I will concentrate on submitting my <future> implementation. GCC doesn't fully support C++0x atomics and I don't grok them yet, so my future and promise classes use a mutex and condition variable for synchronisation.

29 Apr 2009 (updated 29 Apr 2009 at 10:22 UTC) »

(I should know better than to enter a language pissing contest, but ...)

Erm, DeepNorth, do you realise you can use struct and class almost interchangeably?

Some might say that quibbling about giving a second name to structs that have new abilities is silly. However, it is not that I object to the name change. It is that I object to creating an unnecessary distinction between a record that has function pointers (and associated 'behavior') and a record that (for now) does not have such things.
There is no such distinction in C++.


struct Foo
{
    Foo(int ii) : i(ii) { }
    int inc() { return ++i; }
private:
    int i;
};

The return keyword is not consistent. Using it without brackets should be a syntax error.
What's not consistent? You never need them, but if I had to choose, I'd prefer if using it with parentheses was a syntax error!
23 Apr 2009 (updated 24 Apr 2009 at 09:41 UTC) »

As promised to some friends yesterday, here is a toy example of using variadic templates (and new initialization syntax) in C++0x:


#include <vector>
#include <string>
#include <boost/lexical_cast.hpp>
template<typename... T>
  std::vector<std::string>
  to_quoted_strings(T... t)
  {
    using boost::lexical_cast;
    using namespace std;
    return vector<string>{ 
      '"' + lexical_cast<string>(t) + '"' ... 
    };
  }
That function can be used like so:

#include <iostream>
#include <iterator>
#include <algorithm>
int main()
{
  using namespace std;
  vector<string> strings 
    = to_quoted_strings(1, 2.3, "four"); 
  copy(strings.begin(), strings.end(),
    ostream_iterator<string>(std::cout," "));
}
This compiles with GCC 4.4 (using -std=c++0x) and produces the output:

"1" "2.3" "four"
The template parameter pack, t, must be expanded to be used. That expansion is done by putting ... after the expression containing the parameter pack. You can think of it as if the expression containing the parameter pack, expr t, is replaced with:

expr t1, expr t2, expr t3, ... expr tN
for a template parameter pack containing N elements (where N can be obtained by sizeof...(t).)

I'm at the ACCU conference, which is always educational and thought-provoking. The next talk is 'Designing multithreaded applications in C++0x' by Anthony Williams, author of the current version of Boost.Thread, which will be very relevant to my job as well as my free-time GCC hacking.

I'm still working my way through some of the recent C++0x threading features added to libstdc++, currently trying to get a patch applied to fix a fatal error in the implementation of std::call_once for platforms without thread-local storage.

Stevey, nice!

I made a couple of changes:

To avoid having to escape shell metacharacters I changed the open() call to:


  open( CMD, "-|", "grep", @args );
Now I can say tgrep TIME -E '(foo|bar)' logfile without needing to escape the parens and pipe chars.

My logfiles often have milliseconds in the timestamp, in the form HH:MM:DD.mmm, so I changed the regex to match a space or period after the time:


    if ( $line =~ /([0-9][0-9]):([0-9][0-9]):([0-9][0-9])[. ]/ )


12 Mar 2009 (updated 12 Mar 2009 at 16:48 UTC) »

wow, the spammers came out in force today - do your bit for advogato and mark all today's accounts as spam

10 Mar 2009 (updated 10 Mar 2009 at 19:53 UTC) »
ta0kira,
You can even #include "hello, this is kevin", and something isn't right about that.

Now you've lost me. If a file exists with that name, then yes. Otherwise, no. I don't want the pre-processor to try and be smarter and do anything except include the filename it's told to.

172 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!