Tuesday, January 10, 2006

Breaking Myths about C and C++ - Part 1

Breaking Myths about C and C++ - Part 1

Myth C++ is a high level Language

Reality The Answer is NO. Both C and C++ is middle level language. Though, C++ tends toward high –level languages but still it has some middle-level languages feature like pointers. If there are pointers, we can interact with address; we can do that in C++ too.


Myth High level languages are modern and middle-level languages are their ancestors.
Reality This is not at all true. FORTRAN is a high-level language and provides a higher degree of abstraction from C but it was developed earlier and has less features and less flexibility. FORTRAN, BASIC and PASCAL are high-level languages developed much earlier than C or C++. They have one thing common in them, they are non-structured. All the ancient languages are non-structured while modern languages are highly structured. Structured languages are Pascal, Ada, Java, C#, C++, C, Modula-2


Myth we cannot declare a variable with the name main

Reality Yes we can as main is not a keyword, but it will confuse compiler, therefore it is suggested that we should avoid using it.


Myth
#include<stdio.h>
int i;
void func1(void);
void func2(void);
int main(void)
{
i =100;
printf(“%d\n”,i);
func1();
func2();
}
void func1(void)
{
int i =0;
printf(“%d\n”,i);
}

void func2(void)
{
printf(“%d\n”,i);
}
The output of this program will be
100
0
0

Reality
The output will be:
100
0
100

If global variable is declared again locally, the value of global variable in that scope changes locally according to changes in that scope but the changes are not reflected globally.


Myth There are two qualifiers that control how variables may be accessed or modified: const and volatile. A variable cannot be both const and volatile at the same time.

Reality const prevents the variable’s value to be changed if explicitly specified by the program whereas volatile allows the variable’s value to be changed in ways not explicitly specified by the program. For example, a global address may be passed to the operating system’s clock routine and used to hold the real time of the system. In this situation, the value is not changed explicitly changed by the program. Therefore, system clock cannot be changed by any naïve user as well as it gets changed automatically.


Myth extern is another way to declare global variables and extern is used to declare the global variables and function from within the main function.

Reality It is true that when a variable is declared preceding with the extern specifier, it becomes global variable but it is used for different purpose. Suppose, a variable is declared extern, then it is not required to define the variable in the same file and there can be many declarations but only one definition. It is used to make compiler understand that the given variable has external linkages. Thus, compiler will not generate errors if the variable is not defined. extern can be used to declare functions and main functions from outside any function. It is usually used in header files. In C++, While providing linkage specification of function for other languages, extern definition should be written outside any function.

extern “Java”
{
void MyName( )
void ResourceAllocator( )
}

Sunday, January 08, 2006

Extra terrestrial beings and Life on Mars

Everyone wonder that there is a life on another planets? When, the answer comes out “NO” (which is factual), it is hard to believe. How could be believe that we are all alone in the universe. But actually, do we understand what life is? In think, most of the scientists do not understand life.Modern scientists believe that life is a system which itself develop, interact with surroundings and evolve accordingly and believe that ‘mantra’ behind all this miracle is complex form of acid commonly known as DNA.

In ancient philosophy of Jainism, even stones were considered living beings. Stone is a material, which is made of simple compounds very common in nature. So, why they were consider living beings? They do not have any DNA. Do they evolve accordingly to their surroundings? Yes, they do. Sedimentary rocks changes into metamorphic rocks to bear the heat and pressure. You may call it a reaction but the point is that they change themselves to bear the harsh condition. Do they reproduce? I think the only way they reproduce or dies is through volcanic eruption. And It has been noted that Volcanoes reciprocate like living beings. Some are dormant, some are active but they respond very greatly when you get near them but some like in Java, they will blow you up if you get near to them.So, could we consider earth as living being? It can be treated as a life. Even everything, which has the mass in the universe, could be treated as life. And they will respond to us but by their own means. It may take a long time (natural changes can be considered as a response from the nature for our doings) or it may happen in a very short period of time.

So, The first question about the existence of life is clear. Life is spread all around the universe. Now, we want to find those living beings, which could interact with us and create an immediate impact on us. Every time, a new moon is discovered; it hardly create an impact on us because we know that it would have been there for a very long period of time and it was just not known to us. But suppose, we find a living being, which can respond or interact with us, it would mean a lot to us. When we found some bacteria in rocks of Mars found in Antarctica, it created a psychological impact on us. But the impact vanished when we found that we cannot interact with it (excluding scientists!!).

When we will found a living being (not dead) and we can interact with it, then our quest for life on other planets will come to end. If, we can interact with ET (not necessarily intelligent and fast), we will have a better understanding of life.It is quiet possible that ETB do not have a DNA and they may be using another type of development and evolving mechanism, which could more or less efficient than mechanism adopted by living being on earth. Or it is quiet possible that they are using the same type of mechanism and it is common in the entire universe or particular galaxy.One essential condition for life is that it should have mass. So, it is better to assume that life cannot exist in the form of sub atomic particles, which do not have a mass. But still, they are many sub atomic particles, which have mass like meson. And it is very possible that they may be planet, which could be made of another baryon and fermions, entirely different from that part of universe we know. The nature of life existing there is totally unpredictable.

So, let us concentrate to the region, which is predictable. DNA is a complex compound formed due to supernatural reactions. It is quiet possible that DNA might have been formed in the comets and space dust when birth of star takes place. Because, this is only place from where, I think from where DNA might come. If it is so, then why life is not yet found on other planets of the solar system? The atmospheric conditions are very harsh or very different on other planets when compared to that of earth. It is very astonishing that we are searching for life that we found on earth.Let us take Mars? First, the temperature changes from –140 to 20° C. To bear such a high temperature, a living being can do three things. Either run in the valleys on the mars during daylight, (recently found) where temperature is very low than to the surface of earth and come out in the night on the surface of the earth. They should be efficient in climbing and running. But energy on the mars is less. So, if there are living beings in the valley, they may hibernate during night instead of climbing to surface.

Then, they may thick shell or flesh to prevent the escape of heat if they are hot blooded animals (if they have blood), which would be making nearly 70 to 80% percent of their mass. So the possibility of intelligent hot-blooded animals is very less. If they live on the surface, they may be slow moving or even still, rock like creatures with very thick shells although photosensitive or thermo-sensitive to capture energy and carries out process like photosynthesis.But are we really interested in that kind of ETB? No. We are interested in something active.

We call Mars a dead planet which was alive some millions of years ago. There were volcanoes at some time but now, everything is dead. We dont know yet how a active planet dies. We have only hypothesis. I've some strange feeling sometimes. I feel that there are martians on that planet and they have shifted below the surface of Mars and utilizing the whole resource of Mars including its internal energy while leaving the surface as it is. They might have turned magma tunnels to their direction to generate heat and electricity and use valleys and deep trenches as port to the solar system. The whole carbon dioxide present in their atmosphere prevents the energy to escape.But this whole thing is pure fantasy. To find the truth, we have to go and search there. 

Friday, January 06, 2006

Buying a ‘Phoren’ Car??

Mercedes launched a new car? Skoda is now selling cars in India! Wow!! Wait, are you a Phoren car maniac and will go for the phoren car dumping your own indian car. Then, you are in big trouble.

Phoren cars’ manufacturers come to India to sell their goods and they don’t earn much profit here, they leave. Those who bought these cars in the haste without doing proper research might land in the problem which is going to circumvent for the coming years.

A person who bought Peugot 309 about 7 years ago now blame himself for the sorrow state of his car. He sorrowfully recalls, “ When I bought this car about 7 years ago, I was filled with pride. My new foreign car was then my status symbol”. He adds, “ This car performed exceptionally well in the first few year, but later on, it performance degraded as no service center were available. We ‘ve to order auto-parts from Delhi and maintaining this car became a big headache for me. Now it’s a showpiece in my Garage.”

There are many people who share their same problems. Before buying a ‘Phoren Car’, make sure that the car you purchased have some maintenance centers around your city. It is suggested that you must not only focus on features and looks of cars, but every tits and bits of it.

Purchasing a car for most of the people is a long –term investment of their valuable money. Make sure that you are buying the right one.

To do further research, visit
www.indiacars.com

Babu Priyavrat

This page is powered by Blogger. Isn't yours?