Re: Newbie - Shared library
- From: Måns Rullgård <mru@xxxxxxxxxxxxx>
- Date: Tue, 31 Jan 2006 21:21:32 +0000
Joseph2k <joseph2k@xxxxxxxxxx> writes:
> Ray wrote:
>
>> On Thu, 2005-12-15 at 00:21 -0500, Carlos Moreno wrote:
>>
>>> You have to understand that in C++, like in C, you have two
>>> distinct notions: declaration and definition.
>>>
>> Yes. A declaration merely reserves space in RAM for the class or
>> variable. A definition tells the computer what's going to be IN that
>> space.
>>
>>
>>
> No, function and class declaration does not. Function or class declaration
> reserves namespace and possibly a pointer to linkage for something. Only
> variable declaration can reserve space memory.
A variable declaration doesn't reserve memory either. Consider
extern int foo;
That's a declaration, not a definition, and so does not reserve
memory. A variable *definition*, which does reserve memory, looks
like
int foo;
or
static int foo;
Ray was thinking of the difference between definition and
initialization. In the case of variables, the former reserves space,
the latter also specifies the data. Functions are a little different
in that they can never be defined without also being "initialized".
They will also typically be stored in read-only memory pages.
--
Måns Rullgård
mru@xxxxxxxxxxxxx
.
- References:
- Re: Newbie - Shared library
- From: Joseph2k
- Re: Newbie - Shared library
- Prev by Date: LD_ASSUME_KERNEL questions
- Next by Date: Re: working with files the linux way...
- Previous by thread: Re: Newbie - Shared library
- Next by thread: LD_ASSUME_KERNEL questions
- Index(es):
Relevant Pages
|