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.
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.
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.
char raw[] = R"#(s/"\([^"]*\)"/'\1'/g)#";
which is equivalent to:
char yuk[] = "s/\"\\([^\"]*\\\"/'\\1'/g";
only without suffering from leaning toothpick syndrome.# 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 )", which would be taken as the end of the raw string otherwise:
char raw[] = R"(s/"\([^"]*\)"/'\1'/g)"; // ERROR!
"" as the delimiter sequence, as a nod to Python
char raw[] = R"""(triple-quoted for great justice)""";
broonie asked what's wrong with switch statements?
The default behaviour of switch statements is broken, it's too easy to forget a break and introduce a fall-through bug. That's harder to do with the if-else-if-else form.
Breaking after each case should have been the default and continue should have been required to explicitly fall through. It wouldn't even have needed a new keyword.
the purpose of the trust metric is to certify that a given user account on Advogato 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.
std::bind can do that lambdas can't.
#include <functional>
#include <string>
#include <iostream>
struct Polly
{
template<typename T, typename U>
auto operator()(T t, U u) const -> decltype(t + u)
{ return t + u; }
};
int main()
{
auto polly = std::bind(Polly(), std::placeholders::_1, "confusing");
std::cout << polly(4) << polly(std::string(" this is ")) << std::endl;
}
I wrote previously about needing to hack 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:
GCC_DIR=/your/gcc/prefix
GCC_VER=4.4.3
GCC_ARCH=x86_64-unknown-linux-gnu
../llvm/configure --prefix=$PREFIX --enable-targets=host \
--enable-optimized --disable-jit \
LDFLAGS=-Wl,-R,$GCC_DIR/lib64 \
--with-cxx-include-root=$GCC_DIR/include/c++/$GCC_VER \
--with-cxx-include-arch=$GCC_ARCH
make CFLAGS=-std=gnu89
Building GCC is not trivial, but is not difficult if you follow the instructions carefully.
Many people rush into trying to build it without reading the installation docs properly and make one or more of these common mistakes:
1) do not run ./configure - this is not supported, you need to run configure from outside the source directory
2) if GCC links dynamically to the prerequisite libs (GMP/MPFR/MPC) then the shared libraries must be in the dynamic linker's path, both when building gcc and when using the installed compiler.
These problems are easily avoided by reading http://gcc.gnu.org/install/prerequisites.html, http://gcc.gnu.org/install/configure.html, http://gcc.gnu.org/wiki/FAQ#configure and http://gcc.gnu.org/wiki/FAQ#configure_suffix but noone does that.
For the impatient or RTFM-intolerant, a foolproof recipe for building GCC is given below.
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 http://gcc.gnu.org/install/prerequisites.html and is much easier than building and installing the prerequisites separately, but everyone seems to choose the hard way.
THIS RECIPE IS NOT A SUBSTITUTE FOR RTFM.
If you decide to stray from this recipe without reading the docs do not be surprised if you get indigestion.
* Ingredients:
1 gcc source package (e.g. gcc-4.6.2.tar.gz)
Alternatively, download individual packages for each GCC language front end (e.g. gcc-core, gcc-g++ etc.)
* Method:
First prepare your environment, season these variables to taste:
# the version you will build
gccver=4.6.2
# where you put the downloaded source packages
pkgdir=$HOME
# where you will build gcc
rootdir=$HOME/gcc-tmp
# where you want to install gcc
prefix=/opt/gcc-${gccver}
# the languages you want gcc to support
langs=c,c++
mkdir ${rootdir}
cd ${rootdir}
tar xzf ${pkgdir}/gcc-${gccver}.tar.gz
cd gcc-${gccver}
./contrib/download_prerequisites
cd ..
mkdir objdir
cd objdir
${rootdir}/gcc-${gccver}/configure --prefix=${prefix} --enable-languages=${langs}
make
make install
RIP, dmr
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!