Skip to main content

September 2009


Few words about me. I'm lyuts(really?) and I'm a software engineer and interested mostly in Unix/Linux/C/C++ and so on.

When I have free time I'm working on an opensource project Visual-DB.

Problem #3

Posted in

int var = 7;
printf("%f\n", var);

Q: What will this print?
A: Unpredictable behavior

Problem #2

Posted in

static int a = 0, b = 3;
int change_a() { return ++a; }
int change_b(int x) { return b+=x; }
void func(int x)
    static int aa = change_a();
    static int bb = change_b(x);

Problem #1

Posted in

struct S {
    static int i;
    S() { ++i; }
    S(const S&) { ++i; }
int S::i = 0;
int main() {
    S v(S());
    return S::i;

Keeping FreeBSD updated

Posted in

When I need to update my FreeBSD (I'm not talking about major release upgrade) I do this:

# freebsd-update fetch

Qt Creator 1.2.1 on FreeBSD

Posted in

The next version of Qt Creator is out and we want it on FreeBSD. So here are the patches.


Qt Creator 1.2 on FreeBSD

Posted in

Qt Creator 1.2 is coming soon, so I think it's time to get ready for it.
Here are new patches for this release.

The sources (in fact, the snapshot) for this release were downloaded from

>>> Patches <<<

Qt Creator plugins on FreeBSD

Posted in

While creating patches for Qt Creator to get it working on my FreeBSD I have noticed that not all its plugins have been compiled and (let us say so) installed. All plugins live here


Qt Creator 1.1 on FreeBSD

Posted in

Here are patches for Qt Creator. Done by me after I have successfully created similar patches for Qt Creator 1.0.

Overloading << for a custom class

Posted in

Q: Why overload << operator outside your own class and then make it its friend? Why not make it a member?

mutable VS const

Posted in

class A {
  mutable int value1;
     int getValue1() const;
int A::getValue1() const
  return ++vaue1;

Hex in vim

Posted in

map <F4> :execute HexView()<CR>
let s:hflag=0
function! HexView()
    if s:hflag == 0
        let s:hflag=1
        return ":%!xxd"
        let s:hflag=0

How does it work: FreeBSD boot loader.

Posted in

Boot loader? What is this? And what is this for?

Comments in vim

Posted in

When writing code, I always wanted to be able to select a block of code and then [un]comment it. Here are my attempts to make it possible. The main achievent is that it works in 'VISUAL' mode too.

Placement new operator

Posted in

void *buf = reinterpret_cast<void*>(0xf01f);
X *x = new (buf) X;

Corrupted reference

Posted in

One of the things that differs a reference from a pointer is the fact that any reference MUST be initialized (just like constants). One might think that this guarantees safe usage of references.

What would you use for your project?

0% (0 votes)
100% (1 vote)
0% (0 votes)
0% (0 votes)
boost jam
0% (0 votes)
0% (0 votes)
Your own tool
0% (0 votes)
Total votes: 1

Qt 4.5 on FreeBSD

Posted in

As soon as I found out that Qt 4.5.0 was released I wanted it installed on my FreeBSD.

FreeBSD loader logo

Posted in

Remember those days, when you could see nice ASCII-style Beastie when your FreeBSD start up? I remember that when i used to work with FreeBSD 5.3. With new major releases, such as 6 and 7, the default logo is an ASCII word 'FreeBSD'.

If you look into /boot/beastie.4th you will see that all available logos are defined here.

The acceptable logos are:

  • fbsdbw
  • beastie
  • beastiebw
  • none

So if you want to change the default logo, just put the following line in you /boot/loader.conf (I have chosen 'beastiebw')

Return const reference

Posted in

class Q
        Q() { x = 7;}
        int& getX() { return x; }
        int x;

First blog entry

Welcome to, the blog-site on various topic: algorithms, C++, FreeBSD and Unix in general, vim, and lots of other things that may be of some interest for me (And hope, that of some interest for you.)
This blog used to be located at