Re: external variables
- From: Larry Gates <larry@xxxxxxxxxxxxxxx>
- Date: Wed, 11 Feb 2009 20:41:36 -0700
On Wed, 11 Feb 2009 18:10:07 -0800, Keith Thompson wrote:
Larry Gates <larry@xxxxxxxxxxxxxxx> writes:
On Tue, 10 Feb 2009 07:54:55 -0500, pete wrote:
Also, you can have a declaration with the extern keyword
inside of a function definition.
Well, if you can't declare a function from within a function, what use is
the keyword extern going to do you there?
You can't *define* a function within a function definition:
void outer(void) {
void inner(void) { } /* ILLEGAL */
}
You can *declare* a function within a function definition:
void func(void) {
extern void external_function(void); /* OK */
}
but it's no necessarily a good idea. Normally function declarations
like this (prototypes) should be in header files, not buried inside
function definitions.
And that extern is necessary there?
--
larry gates
Perl itself is usually pretty good about telling you what you shouldn't
do. :-)
-- Larry Wall in <11091@xxxxxxxxxxxxxxxxxxxxxxx>
.
- Follow-Ups:
- Re: external variables
- From: Keith Thompson
- Re: external variables
- References:
- external variables
- From: Larry Gates
- Re: external variables
- From: pete
- Re: external variables
- From: Larry Gates
- Re: external variables
- From: Keith Thompson
- external variables
- Prev by Date: Re: c to c++
- Next by Date: Re: Windows graphics problem
- Previous by thread: Re: external variables
- Next by thread: Re: external variables
- Index(es):
Relevant Pages
|