-----Original Message-----
From: shashi kiran [mailto:kiran_vee@yahoo.com]
Sent: Wed 9/15/2004 8:56 AM
To: Vijay Zanvar (WT01 - TELECOM SOLUTIONS)
Cc:
Subject: Re: Magic numbers
> Hai vijai,
"Hai" could be "Hi", but "vijai" is definitely not "Vijay"! ;o)
[..]
> Kindly calrify me the doubt y so much of stress is specified on MAGIC naumbers
> and what r its advantages.
Interpretation of the word, `magic number', depends on the context. As far as
I can strech my knowledge, I can think of only two contexts. They are:
1. Certain formatted files -- for example, executables -- begin with a block of data
called as 'headers'. A header contains useful information that help a utility
program or a command interpreter to let know what type of file it is. One such a
field in the header is generally called MAGIC number, which helps in the
recognition of a particular file.
For example, the file(1) command uses the MAGIC number field of the ELF executable
to display the result.
bash-2.03$ file a.out
a.out: ELF 32-bit MSB executable SPARC Version 1, dynamically linked, not stripped
2. MAGIC numbers in a source file. A numeric literal appearing in a source file is
often termed as a MAGIC numbe. MAGIC numbers, in this context, are NOT advisable as
they carry information very few people can understand. In the C Programming
Language, one can use macros to avoid MAGIC numbers.
For example,
#define DAYS_PER_WEEK 7
DAYS_PER_WEEK lets the reader know immediately as what this constant/value is supposed
to mean, as against the numeral, 7.
> Kindly send ur contact details.
> Regards
> Kiran
               (
geocities.com/vijoeyz/faq)                   (
geocities.com/vijoeyz)