Even though I started programming more than 16 years ago and got to used to several different programming languages in the meantime, this is the first time I came across the behaviour shown below.
Assume the following piece of code:
int main(int argc, char *argv[]) {
int x = -2;
unsigned int y = 10;
std::cout << (x * y) << std::endl;
std::cout << (x - y) << std::endl;
}
I’d have expected something like
-20
-12
but instead it returns
4294967276
4294967284
Obviously, this is a type casting issue. Well, more a kind of peculiarity caused by the C/C++ type hierarchy: The signed integer is promoted to an unsigned int, causing the whole calculation to be handled this way. Nothing new but quite interesting for me and some colleagues, though :)
For more information in C/C++ type casting issues, have a look at the following web page: http://www.learncpp.com/cpp-tutorial/44-type-conversion-and-casting/
In his blog, Nigel McNie provides a nice hands-on introduction to LXC. Along with this, he provides us with a set of scripts that do the work quite nicely. I cloned that repository and added a script for Ubuntu Lucid. It’s quite handy to me, supposedly also for somebody else out there?
A git repository is available at GitHub: http://github.com/phbaer/lxc-tools
Quite a few colleagues and friends were interested in the LaTeX template I used for my theses. As it clearly evolved during the last years, my diploma looks quite different, though :)
For those who are interested: I just created a new webpage where you can download the archive. It contains both the LaTeX sources and LyX files. Feel free to use or modify them. I’d also be very happy to also receive comments or modifications!
Have fun :)
I should really stick to resolutions I made: do not (in any case) read business mails on the weekend or in the free time!
Even though it’s quite straightforward to realise, I’ve uploaded an algorithm2e module for LyX (> 1.6.0) that adds support for the algorithm2e class (instead of algorithm).
Maybe it’s useful for some of you out there.