comp.lang.ada
 help / color / mirror / Atom feed
* differences between C and Ada
@ 1999-07-22  0:00 aurelien_ratti
  1999-07-22  0:00 ` Ted Dennison
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: aurelien_ratti @ 1999-07-22  0:00 UTC (permalink / raw)


Hello.

What is the difference between C's static variables and Ada's global
variables ?

Thank you for your help.

	Aurelien


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: differences between C and Ada
  1999-07-22  0:00 differences between C and Ada aurelien_ratti
  1999-07-22  0:00 ` Ted Dennison
  1999-07-22  0:00 ` Martin Gangkofer
@ 1999-07-22  0:00 ` czgrr
  1999-07-22  0:00   ` Steve Folly
  2 siblings, 1 reply; 6+ messages in thread
From: czgrr @ 1999-07-22  0:00 UTC (permalink / raw)


In article <7n6ioe$lkd$1@nnrp1.deja.com>,
  aurelien_ratti@my-deja.com wrote:
> Hello.

Hello.


> What is the difference between C's static variables and Ada's global
> variables ?

One difference is that Ada's global variables have to be, er, global.
That means anything in the package that declares them can access them.
In C++ (and, I assume, C), a static variable can be declared at local
scope, but still has the lifetime of a global.

Another difference is that the C++ compiler will automatically
initialise a static variable to 0 before it is first used. In Ada, you
still have to explicitly initialise it.

A third difference (possibly, I haven't tried it) is that if you have a
C++ class with a static variable, there is only one instance of the
variable regardless of how many objects there are of that class, even
if there are none. In Ada (I think), a global variable in a generic
package exists once per instantiation. Don't know if or how this
translates to C.

I'm sure there's more.

Cheers,
czgrr
--
Email address blocked - reply to the newsgroup.
Assume Ada83 and (V)C++ unless said otherwise.
My opinions are independent from my employer's.
Use any suggestions at your own risk.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: differences between C and Ada
  1999-07-22  0:00 differences between C and Ada aurelien_ratti
  1999-07-22  0:00 ` Ted Dennison
@ 1999-07-22  0:00 ` Martin Gangkofer
  1999-07-22  0:00 ` czgrr
  2 siblings, 0 replies; 6+ messages in thread
From: Martin Gangkofer @ 1999-07-22  0:00 UTC (permalink / raw)


In article <7n6ioe$lkd$1@nnrp1.deja.com>,
  aurelien_ratti@my-deja.com wrote:
> Hello.
>
> What is the difference between C's static variables and Ada's global
> variables ?
>
> Thank you for your help.
>
> 	Aurelien
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
>
the only difference I have noticed is, that C static variables are
initialised not by assignment because C does not know something like
elaboration, while ADA global variables may explicitly be initialised.

Martin.

--
Martin Gangkofer, System Engineer
ESG Elektroniksystem und -Logistik GmbH, Dept.EF-E
eMail: mgangkof@esg-gmbh.de
Tel:   +49 89 9216 2176


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: differences between C and Ada
  1999-07-22  0:00 differences between C and Ada aurelien_ratti
@ 1999-07-22  0:00 ` Ted Dennison
  1999-07-22  0:00 ` Martin Gangkofer
  1999-07-22  0:00 ` czgrr
  2 siblings, 0 replies; 6+ messages in thread
From: Ted Dennison @ 1999-07-22  0:00 UTC (permalink / raw)


In article <7n6ioe$lkd$1@nnrp1.deja.com>,
  aurelien_ratti@my-deja.com wrote:
> Hello.
>
> What is the difference between C's static variables and Ada's global
> variables ?

"static" in C can mean several different things, depending on the
context. What type of "static" were you thinking of?

--
T.E.D.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: differences between C and Ada
  1999-07-22  0:00 ` czgrr
@ 1999-07-22  0:00   ` Steve Folly
  1999-07-26  0:00     ` aurelien_ratti
  0 siblings, 1 reply; 6+ messages in thread
From: Steve Folly @ 1999-07-22  0:00 UTC (permalink / raw)



czgrr <czgrr@my-deja.com> wrote in message
news:7n718n$pet$1@nnrp1.deja.com...
> In article <7n6ioe$lkd$1@nnrp1.deja.com>,
>   aurelien_ratti@my-deja.com wrote:
> > Hello.
>
> Hello.
>
>
> > What is the difference between C's static variables and Ada's global
> > variables ?
>

<snipped good answer>

Has that answered your homework question, Aurelien?


--
Regards,
Steve Folly -  Y2K compliant since 32nd Februark 1998
http://www.follysplace.demon.co.uk
donationsto:myaccount@mybank.co.uk






^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: differences between C and Ada
  1999-07-22  0:00   ` Steve Folly
@ 1999-07-26  0:00     ` aurelien_ratti
  0 siblings, 0 replies; 6+ messages in thread
From: aurelien_ratti @ 1999-07-26  0:00 UTC (permalink / raw)




> > > What is the difference between C's static variables and Ada's
global
> > > variables ?
> >
>
> <snipped good answer>
>
> Has that answered your homework question, Aurelien ?
>

Yes, it seems to be quite complete ! But if you know other differences,
I'm still interested in.

Thank you for your answers.

	Aurelien


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~1999-07-26  0:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-07-22  0:00 differences between C and Ada aurelien_ratti
1999-07-22  0:00 ` Ted Dennison
1999-07-22  0:00 ` Martin Gangkofer
1999-07-22  0:00 ` czgrr
1999-07-22  0:00   ` Steve Folly
1999-07-26  0:00     ` aurelien_ratti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox