Sunday, August 26, 2007

How to read C declarators PART 1

Reading C declarators in a precise manner.

The rule goes like this:

"Start at the variable name (or innermost construct if no identifier is present. Look right without jumping over a right parenthesis; say what you see. Look left again without jumping over a parenthesis; say what you see. Jump out a level of parentheses if any. Look right; say what you see. Look left; say what you see. Continue in this manner until you say the variable type or return type."

The degenerate case is:
 int i;

Starting at i, you look right and find nothing. You look left and find the type int, which you say. Done.

Ok, now a more complicated one:

 int *a[3];

Start at a. Look right, say array of size 3. Look left and say pointer. Look right and see nothing. Look left and say int. All together you say a is an array of size 3 pointers to int.

Adding parentheses is when it gets weird:

 int (*a)[3];

The parentheses change the order just like in an expression. When you look right after a, you see the right parenthesis, which you cannot jump over until you look left. Hence, you would say a is a pointer to an array of 3 ints.

bye for now
Al

Saturday, August 25, 2007

pass/fail - profit/loss

When a person fails at something they may mistakenly believe they are heading in the opposite direction from the success they desire. Yet when you really think about the positive implications of failure you have to conclude that being a failure at anything is a sure step in the right direction to your success. Both failure and success are steps in the right direction and they are more like twin sisters than distant relatives.


We start with failure because most of us are experts in this field. If you ask a random person if they considered themselves a failure or a success they would most likely tell you they have failed more than a time or two in the past. They may even go on to tell you a juicy story of a recent failing and falling and how they missed reaching a goal or a dream.

After they conclude their litany of disaster ask them about their successes. They would confront you angrily saying, "I just told your how I failed and that should have showed you clearly that I am not a success."

Real self development and self improvement come in
recognizing this larger understanding about failure.

Because we value success so much, we tend to exaggerate the effects of failure. We wrongly conclude that failure means we did not succeed. But failure isn't the end of the world. You won't die from it. With failure -- you fail, you pick yourself up and you go on.

Have at it right now. Go ahead and take the risk. Go ahead and fail. Because that means you are well on your way to your sure success. So you see in order to succeed all you have to do is fail a lot and learn from it.

SHAKIRA - HIPS DON'T LIE LYRICS

SHAKIRA - HIPS DON'T LIE LYRICS:

Ladies up in here tonight
no fighting, no fighting
We got the refugees up in here
No fighting, no fighting

Shakira, Shakira

I Never really knew that she could dance like this
She makes a man want to speak Spanish
Como si llama, bonita, mi casa, su casa

Shakira, Shakira

Oh baby when you talk like that
You make a woman go mad
So be wise and keep on
Reading the signs of my body

and I'm on tonight
You know my hips don't lie
And I'm starting to feel it's right
all the attraction, the tention
Don't you see baby, this is perfection

Hey Girl, I can see your body moving
And it's driving me crazy
And I, didn't have the slightest idea
Until I saw you dancing

And when you walk up on the dance floor
Nobody cannot ignore the way you move your body, girl
And everything so unexpected -the way you right and left it
So you can keep on shaking it

I never really knew that she could dance like this
She makes a man want to speak Spanish
Como si llama,si bonita, si mi casa, su casa

Shakira, Shakira

Oh baby when you talk like that
You make the woman go mad
So be wise and keep on
Reading the signs of my body

I am on tonight
You know my hips don't lie
And I am starting to feel you boy
Come on lets go, real slow
Don't you see baby asi es perfecto

Oh I know I am on tonight my hips don't lie
And I am starting to feel it's right
All the attraction, the tension
Don't you see baby, this is perfection

Shakira, Shakira

Oh boy, I can see your body moving
Half animal, half man

I don't, don't really know what I'm doing

But you seem to have a plan
My will and self restraint
Have come to fail now, fail now
See, I am doing what I can, but I can't so you know
That's a bit too hard to explain

Baila en la calle de noche
Baila en la calle de noche

Baila en la calle de noche
Baila en la calle día

I never really knew that she could dance like this
She makes a man want to speak Spanish
Como si llama,si bonita, si mi casa, su casa

Shakira, Shakira

Oh baby when you talk like that
You know you got me hypnotized
So be wise and keep on
Reading the signs of my body



Señorita, feel the conga, let me see you move like you come from Colombia

Mira en Barranquilla se baila así, say!
Mira en Barranquilla se baila así

Yeah

She's so sexy every man's fantasy a refugee like me back with the refugees from a 3rd world country
I go back like when 'pac carried crates for Humpty Humpty
We need a whole club dizzy
Why the CIA wanna watch?
From Colombians and Haitians

I ain't guilty, it's a musical transaction
No more do we snatch ropes
Refugees run the seas 'cause we own our own boats

I'm on tonight, my hips don't lie
And I'm starting to feel you boy
Come on let's go, real slow
Baby, like this is perfecto



Oh, you know I'm on tonight and my hips don't lie
And I am starting to feel it's right
The attraction, the tension
Baby, like this is perfection.



no fighting!

no Fighting.

Thursday, August 23, 2007

philosophy mingled

thou who say tomorrow never comes.... thou shalt never see new dawn of future....

It's not that hard to imagine this truth that lies solely in our mind. One who tries to avoid something, is the one who fear from it the most. And the biggest disadvantage that he has is this point only.
To gain something in future you have to devote a part of your present.... and it sure matters in which way even if you don't accept it. It can be mapped to the complication of making a choice. It doesn't matter for others how you make a choice but when it is made they are there right in front of you.

Rest later
AL

Thursday, July 26, 2007

Programing style review

Hi comp folks .....

Everyone who have some sort of coding style might find this interesting.

Coding fundas -
1. Follow the single-entry/single-exit rule. Never write multiple return statements in the same function.

2. Never, ever, EVER return references to local objects.

3. Prefer preincrement, avoid postincrement.

4. Prefer passing const& instead of copied values.

5. Watch out for hidden temporaries created by parameter conversions. One good way to avoid this is to make ctors explicit when possible.

read more on Guru of the week.


Bye for now....
Al

Thursday, June 7, 2007

RSS Reader