<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>Advogato blog for redi</title>
    <link>http://www.advogato.org/person/redi/</link>
    <description>Advogato blog for redi</description>
    <language>en-us</language>
    <generator>mod_virgule</generator>
    <pubDate>Fri, 10 Feb 2012 15:23:39 GMT</pubDate>
    <item>
      <pubDate>Wed, 8 Feb 2012 16:46:59 GMT</pubDate>
      <title>8 Feb 2012</title>
      <link>http://www.advogato.org/person/redi/diary.html?start=261</link>
      <guid>http://www.advogato.org/person/redi/diary.html?start=261</guid>
      <description>&lt;a href="" 'http://advogato.org/person/fzort/diary/203.html'&gt;fzort&lt;/a&gt; and &lt;a href="" 'http://advogato.org/person/cdfrey/diary/90.html'&gt;cdfrey&lt;/a&gt;, the conditional (a.k.a ternary) operator doesn't strictly require the second and third operands to have the same type, but it must be possible to convert one operand to the type of the other. In fzort's example both needed to be converted to &lt;tt&gt;foo*&lt;/tt&gt;, neither can be converted to the other type, so it's ill-formed.&lt;br/&gt;
&lt;br/&gt;
(There is another form allowed which doesn't require conversion, where one of the operands is a throw-expression:  &lt;tt&gt;which ? new foo : throw "catch me"&lt;/tt&gt;.  This isn't entirely useless syntactic sugar, it can be used to throw exceptions from &lt;tt&gt;constexpr&lt;/tt&gt; functions, which don't allow &lt;tt&gt;if&lt;/tt&gt; statements.)&lt;br/&gt;
</description>
    </item>
    <item>
      <pubDate>Thu, 12 Jan 2012 21:43:57 GMT</pubDate>
      <title>12 Jan 2012</title>
      <link>http://www.advogato.org/person/redi/diary.html?start=260</link>
      <guid>http://www.advogato.org/person/redi/diary.html?start=260</guid>
      <description>I've finally drunk the git kool aid.  I'd tried it before, but didn't inhale.  Maybe I'm just feeling the effects of that cocktail of mixed metaphors but I really like it.&lt;br/&gt;
&lt;br/&gt;
No more manually copying files between my home machine and my netbook (which isn't big enough or strong enough to handle a whole gcc subversion checkout, let alone the whole git repo) so I can work on the train. And I've already created about one new local branch a day in my gcc clone, so I can juggle fixes for several different PRs at once without constantly applying and reverting patches to my svn working dir.&lt;br/&gt;
&lt;br/&gt;
I signed up to github so I can easily fork other people's repositories and send pull requests via the web interface, but decided to use gitorious for hosting some of my own projects.  I like that gitorious itself is open source, but unfortunately ... it just doesn't work as well!  I don't mind occasional weird rendering bugs on the web pages, but now I can't push/pull anything, due to an ssh error that didn't happen previously. Ho hum, I'll stick with it for a while yet.  Github, on the other hand, is pretty damn slick.</description>
    </item>
    <item>
      <pubDate>Fri, 6 Jan 2012 18:08:40 GMT</pubDate>
      <title>6 Jan 2012</title>
      <link>http://www.advogato.org/person/redi/diary.html?start=259</link>
      <guid>http://www.advogato.org/person/redi/diary.html?start=259</guid>
      <description>&lt;h3&gt;Vim syntax highlighting for C++11 raw strings&lt;/h3&gt;&lt;br/&gt;
&lt;br/&gt;
A little over a year ago I mentioned a &lt;a href="" 'http://www.advogato.org/person/redi/diary/226.html'&gt;vim syntax file for C++0x&lt;/a&gt; which I was using for a while, but it only adds support for some new keywords, not new syntax such as lambda expressions and list-initialization. Last month I found &lt;a href="" 'http://www.vim.org/scripts/script.php?script_id=3797'&gt;cpp11.vim&lt;/a&gt; in the Vim online script database, which intends to support the new C++11 syntax, by replacing your existing cpp.vim entirely.&lt;br/&gt;
&lt;br/&gt;
Not quite satisfied with either of those, I've started using my own &lt;a href="" 'http://gitorious.org/miscripts/miscripts/blobs/master/vim/after/syntax/cpp.vim'&gt;cpp.vim&lt;/a&gt; to extend the default cpp.vim file (which is done by putting it in &lt;tt&gt;~/.vim/after/syntax/cpp.vim&lt;/tt&gt;) with syntax highlighting for the new keywords and also C++11 raw strings.&lt;br/&gt;
&lt;br/&gt;
With my colour settings they look like this:&lt;pre&gt;&lt;code style='background-color:white'&gt;&lt;br/&gt;
  &lt;span style='color:green;font-weight:bold'&gt;char&lt;/span&gt; raw[] = &lt;span style='color:grey'&gt;R"#(&lt;/span&gt;&lt;span style='color:fuchsia'&gt;s/"\([^"]*\)"/'\1'/g&lt;/span&gt;&lt;span style='color:grey'&gt;)#"&lt;/span&gt;;&lt;br/&gt;
&lt;/code&gt;&lt;/pre&gt;which is equivalent to:&lt;br/&gt;
&lt;pre&gt;&lt;code style='background-color:white'&gt;&lt;br/&gt;
  &lt;span style='color:green;font-weight:bold'&gt;char&lt;/span&gt; yuk[] = &lt;span style='color:fuchsia'&gt;"s/&lt;/span&gt;&lt;span style='color:grey'&gt;\"\\&lt;/span&gt;&lt;span style='color:fuchsia'&gt;([^&lt;/span&gt;&lt;span style='color:grey'&gt;\"&lt;/span&gt;&lt;span style='color:fuchsia'&gt;]*&lt;/span&gt;&lt;span style='color:grey'&gt;\\\"&lt;/span&gt;&lt;span style='color:fuchsia'&gt;/'&lt;/span&gt;&lt;span style='color:grey'&gt;\\&lt;/span&gt;&lt;span style='color:fuchsia'&gt;1'/g"&lt;/span&gt;;&lt;br/&gt;
&lt;/code&gt;&lt;/pre&gt;only without suffering from &lt;a href="" 'http://en.wikipedia.org/wiki/Leaning_toothpick_syndrome'&gt;leaning toothpick syndrome&lt;/a&gt;.&lt;br/&gt;
&lt;br/&gt;
The &lt;code&gt;#&lt;/code&gt; in the example can be (almost) any  sequence of zero or more characters acting as a delimiter. The example above requires a non-empty delimiter because the string contains &lt;code&gt;)"&lt;/code&gt;, which would be taken as the end of the raw string otherwise:&lt;br/&gt;
&lt;pre&gt;&lt;code style='background-color:white'&gt;&lt;br/&gt;
  &lt;span style='color:green;font-weight:bold'&gt;char&lt;/span&gt; raw[] = &lt;span style='color:grey'&gt;R"(&lt;/span&gt;&lt;span style='color:fuchsia'&gt;s/"\([^"]*\&lt;/span&gt;&lt;span style='color:grey'&gt;)"&lt;/span&gt;/&lt;span style='color:grey'&gt;'\1'&lt;/span&gt;/g&lt;span style='color:white;background-color:red'&gt;)&lt;/span&gt;&lt;span style='color:fuchsia'&gt;";  // ERROR!&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br/&gt;
&lt;br/&gt;
You could choose to use &lt;code&gt;""&lt;/code&gt; as the delimiter sequence, as a nod to Python&lt;br/&gt;
&lt;pre&gt;&lt;code style='background-color:white'&gt;&lt;br/&gt;
  &lt;span style='color:green;font-weight:bold'&gt;char&lt;/span&gt; raw[] = &lt;span style='color:grey'&gt;R"""(&lt;/span&gt;&lt;span style='color:fuchsia'&gt;triple-quoted for great justice&lt;/span&gt;&lt;span style='color:grey'&gt;)"""&lt;/span&gt;;&lt;br/&gt;
&lt;/code&gt;&lt;/pre&gt;</description>
    </item>
    <item>
      <pubDate>Tue, 20 Dec 2011 13:54:58 GMT</pubDate>
      <title>20 Dec 2011</title>
      <link>http://www.advogato.org/person/redi/diary.html?start=258</link>
      <guid>http://www.advogato.org/person/redi/diary.html?start=258</guid>
      <description>broonie asked &lt;a href="" 'http://advogato.org/person/broonie/diary/107.html'&gt;what's wrong with switch statements?&lt;/a&gt; &lt;br/&gt;
&lt;br/&gt;
The default behaviour of switch statements is broken, it's too easy to forget a &lt;tt&gt;break&lt;/tt&gt; and introduce a fall-through bug.  That's harder to do with the if-else-if-else form.&lt;br/&gt;
&lt;br/&gt;
Breaking after each case should have been the default and &lt;tt&gt;continue&lt;/tt&gt; should have been required to explicitly fall through. It wouldn't even have needed a new keyword.</description>
    </item>
    <item>
      <pubDate>Tue, 20 Dec 2011 10:51:57 GMT</pubDate>
      <title>20 Dec 2011</title>
      <link>http://www.advogato.org/person/redi/diary.html?start=257</link>
      <guid>http://www.advogato.org/person/redi/diary.html?start=257</guid>
      <description>&lt;a href="" '/person/hjclub/diary/3.html'&gt;hjclub&lt;/a&gt;, I repeat this from the Advogato FAQ (emphasis mine):&lt;br/&gt;
&lt;blockquote&gt;&lt;br/&gt;
    the purpose of the trust metric is to certify that a given user account on Advogato &lt;b&gt;is known by the Advogato community to actually belong to the individual who claims it and is known to be a member of the free software and open source community.&lt;/b&gt; &lt;br/&gt;
&lt;/blockquote&gt;&lt;br/&gt;
&lt;br/&gt;
Certifying random spammers because you feel like it doesn't meet the purpose. You are of course free to use the trust metric for something different to its stated purpose, but don't be surprised if you get "exiled" as a spammer when you insist on certifying spammers.  If you happen to know someone is who they claim to be, and they're a real member of the open source community, write a diary entry to say so, telling other users they're not an annoying spammer, even though they have an obviously computer-generated name!&lt;br/&gt;
&lt;br/&gt;
FWIW, a spam rating of 9 does not mean 9 people rated you, users with a Master cert add 3 to a spam rating, Journeyers add 2, and Apprentices add 1, reflecting the trust the community places in people with a higher rating.  So it only takes three Masters to take a spam rating to 9.  I haven't rated you as a spammer because I recognised your username and think you should get a second chance to participate in the community, but if you continue to certify obvious spammers I will use my +3 spamhammer &lt;tt&gt;:)&lt;/tt&gt;</description>
    </item>
    <item>
      <pubDate>Mon, 19 Dec 2011 20:05:35 GMT</pubDate>
      <title>19 Dec 2011</title>
      <link>http://www.advogato.org/person/redi/diary.html?start=256</link>
      <guid>http://www.advogato.org/person/redi/diary.html?start=256</guid>
      <description>Welcome back, hjclub.&lt;br/&gt;
&lt;br/&gt;
Why did you certify fredericpete821 when that's clearly a spammer account?  You got kicked out once &lt;a href="" '/person/redi/diary/201.html'&gt;before&lt;/a&gt; for doing that, after being &lt;a href="" '/person/redi/diary/199.html'&gt;advised&lt;/a&gt; not to.&lt;br/&gt;
&lt;br/&gt;
Certifying spammers is not how to interact with this community</description>
    </item>
    <item>
      <pubDate>Wed, 2 Nov 2011 14:48:59 GMT</pubDate>
      <title>2 Nov 2011</title>
      <link>http://www.advogato.org/person/redi/diary.html?start=255</link>
      <guid>http://www.advogato.org/person/redi/diary.html?start=255</guid>
      <description>&lt;h3&gt;C++11 brainteaser&lt;/h3&gt;&lt;br/&gt;
Here's a little program showing something that &lt;code&gt;std::bind&lt;/code&gt; can do that lambdas can't.&lt;br/&gt;
&lt;pre&gt;&lt;br/&gt;
#include &amp;lt;functional&amp;gt;&lt;br/&gt;
#include &amp;lt;string&amp;gt;&lt;br/&gt;
#include &amp;lt;iostream&amp;gt;&lt;br/&gt;
&lt;br/&gt;
struct Polly&lt;br/&gt;
{&lt;br/&gt;
  template&amp;lt;typename T, typename U&amp;gt;&lt;br/&gt;
    auto operator()(T t, U u) -&amp;gt; decltype(t + u) const&lt;br/&gt;
    { return t + u; }&lt;br/&gt;
};&lt;br/&gt;
&lt;br/&gt;
int main()&lt;br/&gt;
{&lt;br/&gt;
  auto polly = std::bind(Polly(), std::placeholders::_1, "confusing");&lt;br/&gt;
&lt;br/&gt;
  std::cout &amp;lt;&amp;lt; polly(4) &amp;lt;&amp;lt; polly(std::string(" this is ")) &amp;lt;&amp;lt; std::endl;&lt;br/&gt;
}&lt;br/&gt;
&lt;/pre&gt;&lt;br/&gt;
What will it print?</description>
    </item>
    <item>
      <pubDate>Tue, 1 Nov 2011 11:08:17 GMT</pubDate>
      <title>1 Nov 2011</title>
      <link>http://www.advogato.org/person/redi/diary.html?start=254</link>
      <guid>http://www.advogato.org/person/redi/diary.html?start=254</guid>
      <description>I wrote previously about needing to &lt;a href="" 'http://www.advogato.org/person/redi/diary/228.html'&gt;hack&lt;/a&gt; the clang sources to build it with gcc in a non-standard location. That patch is no longer necessary, to enable it to find the GCC headers and runtime files I now configure it as:&lt;br/&gt;
&lt;pre&gt;&lt;br/&gt;
GCC_DIR=/your/gcc/prefix&lt;br/&gt;
GCC_VER=4.4.3&lt;br/&gt;
GCC_ARCH=x86_64-unknown-linux-gnu&lt;br/&gt;
../llvm/configure --prefix=$PREFIX --enable-targets=host \&lt;br/&gt;
  --enable-optimized --disable-jit \&lt;br/&gt;
  LDFLAGS=-Wl,-R,$GCC_DIR/lib64 \&lt;br/&gt;
  --with-cxx-include-root=$GCC_DIR/include/c++/$GCC_VER \&lt;br/&gt;
  --with-cxx-include-arch=$GCC_ARCH&lt;br/&gt;
&lt;/pre&gt;&lt;br/&gt;
&lt;br/&gt;
&lt;br/&gt;
Due to some GNUisms in older versions of glibc (e.g 2.5 in my case) it's necessary to build LLVM with&lt;br/&gt;
&lt;pre&gt;make CFLAGS=-std=gnu89&lt;/pre&gt;&lt;br/&gt;
</description>
    </item>
    <item>
      <pubDate>Thu, 27 Oct 2011 18:36:32 GMT</pubDate>
      <title>27 Oct 2011</title>
      <link>http://www.advogato.org/person/redi/diary.html?start=253</link>
      <guid>http://www.advogato.org/person/redi/diary.html?start=253</guid>
      <description>&lt;strong&gt;An even simpler recipe for building GCC&lt;/strong&gt;&lt;p&gt; Building GCC is not trivial, but is not difficult if you follow the instructions carefully.&lt;p&gt; Many people rush into trying to build it without reading the installation docs properly and make one or more of these common mistakes:&lt;p&gt; 1) do not run &lt;tt&gt;./configure&lt;/tt&gt; - this is not supported, you need to run configure from &lt;i&gt;outside&lt;/i&gt; the source directory&lt;p&gt; 2) if GCC links dynamically to the prerequisite libs (GMP/MPFR/MPC) then the shared libraries &lt;i&gt;must&lt;/i&gt; be in the dynamic linker's path, both when building gcc &lt;i&gt;and&lt;/i&gt; when using the installed compiler.&lt;p&gt; These problems are easily avoided by reading &lt;a href="" 'http://gcc.gnu.org/install/prerequisites.html'&gt;http://gcc.gnu.org/install/prerequisites.html&lt;/a&gt;, &lt;a href="" 'http://gcc.gnu.org/install/configure.html'&gt;http://gcc.gnu.org/install/configure.html&lt;/a&gt;, &lt;a href="" 'http://gcc.gnu.org/wiki/FAQ#configure'&gt;http://gcc.gnu.org/wiki/FAQ#configure&lt;/a&gt; and &lt;a href="" 'http://gcc.gnu.org/wiki/FAQ#configure_suffix'&gt;http://gcc.gnu.org/wiki/FAQ#configure_suffix&lt;/a&gt; but noone does that.&lt;p&gt; For the impatient or RTFM-intolerant, a foolproof recipe for building GCC is given below.&lt;p&gt; The trick to this recipe is that the GMP, MPFR and MPC prerequisites are not installed separately, they are built as part of gcc and linked to statically. This avoids the common problem of installing the shared libraries in a non-standard location and having to tell the dynamic linker how to find them.  This method is documented at &lt;a href="" 'http://gcc.gnu.org/install/prerequisites.html'&gt;http://gcc.gnu.org/install/prerequisites.html&lt;/a&gt; and is much easier than building and installing the prerequisites separately, but everyone seems to choose the hard way.&lt;p&gt; THIS RECIPE IS NOT A SUBSTITUTE FOR RTFM.&lt;br&gt;&lt;br/&gt;
If you decide to stray from this recipe without read the docs do not be surprised if you get indigestion.&lt;p&gt; * &lt;em&gt;Ingredients:&lt;/em&gt;&lt;p&gt; 1 gcc source package (e.g. gcc-4.6.2.tar.gz)&lt;br&gt;&lt;br/&gt;
Alternatively, download individual packages for each GCC language front end (e.g. gcc-core, gcc-g++ etc.)&lt;p&gt; * &lt;em&gt;Method:&lt;/em&gt;&lt;p&gt; First prepare your environment, season these variables to taste:&lt;br/&gt;
&lt;pre&gt;&lt;br/&gt;
  # the version you will build&lt;br/&gt;
  gccver=4.6.2&lt;br/&gt;
  # where you put the downloaded source packages&lt;br/&gt;
  pkgdir=$HOME&lt;br/&gt;
  # where you will build gcc&lt;br/&gt;
  rootdir=$HOME/gcc-tmp&lt;br/&gt;
  # where you want to install gcc&lt;br/&gt;
  prefix=/opt/gcc-${gccver}&lt;br/&gt;
  # the languages you want gcc to support&lt;br/&gt;
  langs=c,c++&lt;br/&gt;
&lt;/pre&gt;&lt;br/&gt;
Create a new directory on a disk with plenty of space and unpack the sources there:&lt;br/&gt;
&lt;pre&gt;&lt;br/&gt;
  mkdir ${rootdir}&lt;br/&gt;
  cd ${rootdir}&lt;br/&gt;
  tar xzf ${pkgdir}/gcc-${gccver}.tar.gz&lt;br/&gt;
&lt;/pre&gt;&lt;br/&gt;
Next, download the prerequisite sources into the gcc source directory:&lt;br/&gt;
&lt;pre&gt;&lt;br/&gt;
  cd gcc-${gccver}&lt;br/&gt;
  ./contrib/download_prerequisites&lt;br/&gt;
  cd ..&lt;br/&gt;
&lt;/pre&gt;&lt;br/&gt;
Now create a build directory and change to it&lt;br/&gt;
&lt;pre&gt;&lt;br/&gt;
  mkdir objdir&lt;br/&gt;
  cd objdir&lt;br/&gt;
&lt;/pre&gt;&lt;br/&gt;
Now configure gcc:&lt;br/&gt;
&lt;pre&gt;&lt;br/&gt;
  ${rootdir}/gcc-${gccver}/configure --prefix=${prefix} --enable-languages=${langs}&lt;br/&gt;
&lt;/pre&gt;&lt;br/&gt;
Now build gcc:&lt;br/&gt;
&lt;pre&gt;&lt;br/&gt;
  make&lt;br/&gt;
&lt;/pre&gt;&lt;br/&gt;
Finally, install gcc:&lt;br/&gt;
&lt;pre&gt;&lt;br/&gt;
  make install&lt;br/&gt;
&lt;/pre&gt;&lt;br/&gt;
Your compiler is now ready to use.&lt;br/&gt;
If something goes wrong you can just remove the entire &lt;tt&gt;$rootdir/objdir&lt;/tt&gt; directory and recreate it and run configure again.  The source dir will be unchanged because it is never altered when you build in a separate dir.&lt;br/&gt;
</description>
    </item>
    <item>
      <pubDate>Thu, 13 Oct 2011 10:34:47 GMT</pubDate>
      <title>13 Oct 2011</title>
      <link>http://www.advogato.org/person/redi/diary.html?start=252</link>
      <guid>http://www.advogato.org/person/redi/diary.html?start=252</guid>
      <description>RIP, dmr</description>
    </item>
  </channel>
</rss>

