Re: one simple question
From: Faz (faz_at_volcanomail.com)
Date: 11/12/03
- Next message: Catalin Pitis: "Re: Mixing C/C++ and Func. Names"
- Previous message: Jeremy Bishop: "Mixing C/C++ and Func. Names"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 12 Nov 2003 12:41:24 -0000
"Thomas Matthews" <Thomas_MatthewsHatesSpam@sbcglobal.net> wrote in message
news:ZA23b.34584$Vx2.15008322@newssvr28.news.prodigy.com...
> Asif wrote:
[]
> > I have been trying to understand the behaviour of char (*pfn)(null)
> > for a couple of days. can some body help me understand the behaviour
> > of char (*pfn)(null) in Visual C++ environment?
[]
You'll most likely find a macro called NULL in one of the Visual C++
headers.
> The declaration:
> char (*pfn)(null);
> is of a pointer to a function taking a "null" type and
> returning a type of char. To my understanding, there is no
> type of "null" in _standard_ C++.
Yes, there is no such type..
No, this doesn't declare a function.
It *would* if "null" were replaced by, say, "float" (which IS a type), or by
"double x" (a type and a name).
Empty brackets would be equivalent to replacing the "null" with "void", ie
also making this a function declaration (like your example later).
The NULL macro often supplied with some compilers means the brackets would
contain a value, hence this would declare a simple char* whose value is 0,
if the OP had uppercased it.
(As it stands its a syntax error :-)
BTW Stroustrup (5.1.1) discourages use of a NULL macro and recommends
instead to use the literal 0 to indicate that the pointer doesn't refer to
an object (leads to fewer problems).
[]
> One cannot assign the value from a "pointer to function" to a
> "pointer to variable".
Not without coercion via an evil cast, true.
("Trust the programmer"..)
-Faz
- Next message: Catalin Pitis: "Re: Mixing C/C++ and Func. Names"
- Previous message: Jeremy Bishop: "Mixing C/C++ and Func. Names"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|