[3467] in java-interest

home help back first fref pref prev next nref lref last post

Re: declaration v.s. definition ambiguity

daemon@ATHENA.MIT.EDU (Michael Daconta)
Mon Nov 13 21:38:50 1995

Date: Mon, 13 Nov 1995 16:50:21 -0700 (MST)
To: garya@village.org (Gary Aitken), java-interest@java.sun.com
From: daconta@PrimeNet.Com (Michael Daconta)

At 09:32 AM 11/13/95 -0700, Gary Aitken wrote:
>
>
>>You seem to be thinking of declaration vs definition as it is used in
>>ANSI C whereby declaration announces to the compiler the identifier and
>>type and whereby definition is both the announcing to the compiler and
>>the reservation of storage space.
>>
>>It seems that this is now changing in C++.
>
>Yes.  I have not read all of the latest draft on this, 
>so I'm probably off then.
>
>>The most simplest way to phrase the question is this:
>>
>>what do you call this:
>>
>>class myObject {
>>        int a;
>>
>>        myObject()
>>        {
>>                a = 0;
>>        }
>>
>>        // other methods
>>
>>}
>>
>>Is it a class declaration  OR
>>      a class definition.
>>
>>If you go by ANSI C:  class declaration (even though there are no classes)
>>          by C++:  class definition
>>          by Java: class definition????
>
>I don't think you have much choice but to call it a class definition, since 
>it is the only thing allowed, and there can be only one of them.
>

I would also agree that it can be called a class definition; however,
since no storage space is reserved for this it goes against the 
ANSI C definition.

I only care which one is chosen so that we can nail down the
working definitions for declaration versus definition.

I think it currently is:

declaration: Only an announcement to the compiler of an identifier to be
reserved in the current name space. In ANSI C, accomplished with the
extern keyword.  For functions accomplished by omitting the function body.
For structures and classes accomplished with type identifier and no body.

definition: An announcement to the compiler of an identifier to be
reserved in the current name space.  For primitive types, accompanied
with a reservation of storage space.  For user-defined types,
accomplished by specifying the structure or class body.  For functions
accomplished by specifying the function body.

How does this sound?

Do any language lawyers disagree?

I am just tired of seeing these terms used interchangeably.  They
should have distinct meanings.

 - Mike Daconta 

-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post