Wednesday, October 19, 2011

How read declaration of types

Declaration standard types not difficult to understand
int a;
But how understood this declaration?
char *(*(**m[][8])())[];

char *(*(**m[][8])())[]; - m it is...char
char *(*(**m[][8])())[]; - m it is an array...char
char *(*(**m[][8])())[]; - m it is an array of arrays...char
char *(*(**m[][8])())[]; - m it is an array of arrays of 8 pointers...char
char *(*(**m[][8])())[]; - m it is an array of arrays of 8 pointers to pointer...char
char *(*(**m[][8])())[]; - m it is an array of arrays of 8 pointers to pointer to function... char
char *(*(**m[][8])())[]; - m it is an array of arrays of 8 pointers to pointer to function wich return...char
char *(*(**m[][8])())[]; - m it is an array of arrays of 8 pointers to pointer to function wich return pointer to array...char
char *(*(**m[][8])())[]; - m it is an array of arrays of 8 pointers to pointer to function wich return pointer to array of pointers to char.
...fuh...
more about this here.

Tuesday, October 18, 2011

Secure boot

"Microsoft has announced that if computer makers wish to distribute machines with the Windows 8 compatibility logo, they will have to implement a measure called "Secure Boot.""  omfg...

Saturday, October 8, 2011

Interview

Today I was been in NTC Protey company. I was wrote tests about programming on C++. They told me, we're call you today or may be tomorrow and report you result. Some questions from test i wrote here may  be someone will be interesting. What questions asks in interview   russians IT-company. The truth it is a first interview, they told me, will be a second interview if i approached them.

class A {
public:
A ();
virtual void f();
virtual ~A ();
private:
/* data */
};

class B : public A{
public:
B();
virtual void f();
virtual ~B();
private:
/* data */
};

void A::f()
{
std::cout<<"A"<<std::endl;
}

void B::f()
{
std::cout<<"B"<<endl;
}

A::A(){}
B::B(){}
A::~A(){}
B::~B(){}

int ff(int bb)
{
return bb++;
}

int ff(A aa)
{
aa.f();
}


int main(int argc, const char *argv[])
{
A *a = new B();
a->f();
ff(*a);
cout<<ff(1)<<endl;
return 0;
}

What will be printed?

Wednesday, October 5, 2011

How C++, can be funny :)

Check this 
int i = 10;
int j = i++ + ++i;
What will be equel j? ))

How about this?
int main(){
int x[x];
j::i;
i::j;
}
This code will work if define namespace like this
namespace j{
const int x =1;
struct i{
static int j;
}
}

Sunday, October 2, 2011

locking for work...

Now I am actively looking for work. In mail I received a message from an employer in which he asked me to write a program. The essence of the classical problem of the program producer - consumer. It must be written on ะก#, they gave me a week, and now I'm writing it.

Tuesday, September 27, 2011

reference vs pointers

I have a little problems with my project. now i am writing messaging protocol, and i have a some difficulties with pointers and references. With the transfer parameters  to functions by reference or pointer.