ali0482
Posts: 5
|
| Posted: 09/28/2010, 4:21 AM |
|
What is namespace?
_________________
[url=http://www.nrzee.com]Software Projects[/url]
[url=http://www.nrzee.com/c-.net/]C# Code[/url]
|
 |
 |
ab5ni
Posts: 177
|
| Posted: 10/09/2010, 6:32 PM |
|
In older languages, such as C and the like, constant definitions and formula were used in a compilers pre-processor. For instance, if I want to manipulate files in Windows or a UNIX-like OS, it'd include this:
#include <stdio.h>
#include <file.h>
The above code was found to be time consuming, not to mention the fact that (sometimes) u'd have to sift through numerous include files to determine what was actually needed to get the job done. This was later resolved by having the stdio.h include file include file.h by default and ignore any additional references in other files to file.h.
Anywho, to remove this problem, OOD languages, such as C++ and other object-oriented languages use something called "name spaces." Basically, all u have to do now is add "using namespace stdio" and everything you will ever need (tons of include files, basically) will be loaded up into the compliers pre-processor and u no longer have to worry about missing out on a particular include file. Less headache, in other words. Many compiler authors consider name spaces as a flat-out kludge, however, mainly because it adds additional work to the preprocessor, and folks tend to learn their OS environment by actually perusing include files. In other words, name spaces tend to hide too much of the tech details behind the scene, leaving the programmer a bit less clued in to what is actually going on and happening. A MUCH better definition of this can be found on wikipedia, which includes numerous programming references.
Regards
_________________
Randall Jouett
Amateur Radio: AB5NI
I eat spaghetti code out of a bit-bucket while sitting at a hash table! And yes, I paid for the meal in cache!
|
 |
 |
|