Link to home
Start Free TrialLog in
Avatar of meow00
meow00

asked on

C++ : declaration ? definition ? alias ?

To C++ expert ?

   Is "extern float a" a declaration ?
   Is the "namespace mystd = std" a declaration ? definition ? or alias ?

   Also, is the "tydef unsigned char byte" a declaration ? definition ? or alias ?

   Thanks a lot !

meow .....
Avatar of marcin1
marcin1

I'm not an expert, but let's try

---------------------------------
extern float a;
This is a declaration, because you don't initialize the value of a.

---------------------------------
namespace mystd = std;

This way you make an alias of the namepace. Compare it to this:

namespace mynamespace
{
       ...
}

Here the namespace is both declared and defined.

---------------------------------
typedef unsigned char byte;
It is a type definition and has nothing to do with variable, function etc. declarations/definitions or namespace aliases.
Avatar of meow00

ASKER

I am sort of confused here .... because based on
"C++ in a nutshell" p24 and p28 .... typedef is only a declaration ?? I don't know if I miss understand it here.....
since this original question ask which of the three is a definition.... then I don't  know if "namespace = std"  a definition
or not ... ?
thanks.
ASKER CERTIFIED SOLUTION
Avatar of tinchos
tinchos

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial