2010-06-17: Type Casting

Even though I star­ted pro­gram­ming more than 16 years ago and got to used to sev­eral dif­fer­ent pro­gram­ming lan­guages in the mean­time, this is the first time I came across the beha­viour shown below.

Assume the fol­low­ing 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 expec­ted some­thing like

-20
-12

but instead it returns

4294967276
4294967284

Obvi­ously, this is a type cast­ing issue. Well, more a kind of pecu­li­ar­ity caused by the C/C++ type hier­archy: The signed integer is pro­moted to an unsigned int, caus­ing the whole cal­cu­la­tion to be handled this way. Noth­ing new but quite inter­est­ing for me and some col­leagues, though :)

For more inform­a­tion in C/C++ type cast­ing issues, have a look at the fol­low­ing web page: http://www.learncpp.com/cpp-tutorial/44-type-conversion-and-casting/

2010-04-25: LXC Scripts for Ubuntu Lucid

In his blog, Nigel McNie provides a nice hands-on intro­duc­tion to LXC. Along with this, he provides us with a set of scripts that do the work quite nicely. I cloned that repos­it­ory and added a script for Ubuntu Lucid. It’s quite handy to me, sup­posedly also for some­body else out there?

A git repos­it­ory is avail­able at Git­Hub: http://github.com/phbaer/lxc-tools

2010-03-12: Thesis Template

Quite a few col­leagues and friends were inter­ested in the LaTeX tem­plate I used for my theses. As it clearly evolved dur­ing the last years, my dip­loma looks quite dif­fer­ent, though :)

For those who are inter­ested: I just cre­ated a new webpage where you can down­load the archive. It con­tains both the LaTeX sources and LyX files. Feel free to use or modify them. I’d also be very happy to also receive com­ments or modifications!

Have fun :)

2010-02-20: Note to myself

I should really stick to res­ol­u­tions I made: do not (in any case) read busi­ness mails on the week­end or in the free time!

2009-09-09: algorithm2e module for LyX

Even though it’s quite straight­for­ward to real­ise, I’ve uploaded an algorithm2e mod­ule for LyX (> 1.6.0) that adds sup­port for the algorithm2e class (instead of algorithm).

Maybe it’s use­ful for some of you out there.

You are currently browsing the archives for the Work category.

Bookmarks

Meta