Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Storgae durations

Reply
Thread Tools

Storgae durations

 
 
jrdacc.i@gmail.com
Guest
Posts: n/a
 
      08-16-2008
what is the difference between the tree storage
durations(static,automatic and dynamic) in C?
 
Reply With Quote
 
 
 
 
Ben Bacarisse
Guest
Posts: n/a
 
      08-16-2008
Richard Heathfield <(E-Mail Removed)> writes:

> http://www.velocityreviews.com/forums/(E-Mail Removed) said:
>
>> what is the difference between the tree storage
>> durations(static,automatic and dynamic) in C?

>
> Firstly, there are only two:


Correction: there _were_ only two.

> ++++++++++++++++++++++++++++++++++++++++++++++++++
> 3.1.2.4 Storage durations of objects
>
> An object has a storage duration that determines its lifetime.
> There are two storage durations: static and automatic.


6.2.4 "Storage durations of objects" now says:

An object has a storage duration that determines its lifetime. There
are three storage durations: static, automatic, and
allocated. Allocated storage is described in 7.20.3.

How did C90 square there being only two with malloc?

--
Ben.
 
Reply With Quote
 
 
 
 
jacob navia
Guest
Posts: n/a
 
      08-16-2008
Richard Heathfield wrote:
> (E-Mail Removed) said:
>
>> what is the difference between the tree storage
>> durations(static,automatic and dynamic) in C?

>
> Firstly, there are only two:
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++
> 3.1.2.4 Storage durations of objects
>
> An object has a storage duration that determines its lifetime.
> There are two storage durations: static and automatic.
> ++++++++++++++++++++++++++++++++++++++++++++++++++
>


This is wrong. Heathfield lives in the past so it is using a
standard that is no longer current. The correct place to
quote is the C standard 6.2.4 Storage durations of objects:

An object has a storage duration that determines its lifetime. There are
three storage durations: static, automatic, and allocated. Allocated
storage is described in 7.20.3.




--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
 
Reply With Quote
 
s0suk3@gmail.com
Guest
Posts: n/a
 
      08-16-2008
On Aug 16, 11:55*am, Richard Heathfield <(E-Mail Removed)> wrote:
> jacob navia said:
>
> <snip>
>
> > This is wrong. Heathfield lives in the past so it is using a
> > standard that is no longer current.

>
> No, Heathfield lives in the real world where almost no conforming C99
> implementations exist, but where almost every platform in existence is
> targetted by at least one of the very many conforming C90 implementations..
> Heathfield refuses to live in a fantasy land in which the pretence is made
> that non-portable constructs will work everywhere just because ISO says
> that they are "standard".
>


How is that relevant in regard to what jacob said? He said the
standard you referred to is no longer current. Whether C99 is portable
is another matter, which is rather pointless to discuss with you, but
let's give it a try:

You say there are a lot more C90 implementations than there are C99
implementations, so C90 is more portable. That's true. But whether C99
is portable in *general* is something different, which is subject to
each person's definition and standards of portability. For people not
trying to run programs on toasters, C99 is surely portable enough.

Sebastian

 
Reply With Quote
 
Antoninus Twink
Guest
Posts: n/a
 
      08-16-2008
On 16 Aug 2008 at 16:55, Richard Heathfield wrote:
> jacob navia said:
>> This is wrong. Heathfield lives in the past so it is using a
>> standard that is no longer current.

>
> No, Heathfield lives in the real world where almost no conforming C99
> implementations exist, but where almost every platform in existence is
> targetted by at least one of the very many conforming C90 implementations.


This is a lie. For example, (as you well know) your interlocutor above
has written a C99 implementation for Win32.

> Heathfield refuses to live in a fantasy land in which the pretence is
> made that non-portable constructs will work everywhere just because
> ISO says that they are "standard".


You'd rather pretend that the current standard doesn't exist, and
deliberately give false out information to people, all to satisfy your
nostalgia for a standard that came in at the time of the first gulf war.

 
Reply With Quote
 
James Kuyper
Guest
Posts: n/a
 
      08-16-2008
Richard Heathfield wrote:
> (E-Mail Removed) said:
>
>> what is the difference between the tree storage
>> durations(static,automatic and dynamic) in C?

>
> Firstly, there are only two:
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++
> 3.1.2.4 Storage durations of objects
>
> An object has a storage duration that determines its lifetime.
> There are two storage durations: static and automatic.
> ++++++++++++++++++++++++++++++++++++++++++++++++++


It may say that in the C90 standard (I don't have a copy) but C99 has
three - the third one is "allocated", which corresponds to the OP's
"dynamic". I'll admit that C90 is more widely supported than C99, but if
you are sincerely sorry that adoption of C99 has gone as slowly as it
has, you should at least mention it's features when answering questions
like this one which do not specify a specific version of the standard.

If C90 didn't have "allocated" storage duration, how were the
corresponding concepts described in C90?
 
Reply With Quote
 
Antoninus Twink
Guest
Posts: n/a
 
      08-16-2008
On 16 Aug 2008 at 17:32, (E-Mail Removed) wrote:
> How is that relevant in regard to what jacob said?


He knows full well that it isn't. In case you haven't worked it out, his
only aim in this thread is to further his nasty campaign against Jacob.
He's not interested in addressing Jacob's valid and well-made points. In
fact, his isn't interested in much at all except preening his vast ego -
surely one of the reasons he despises Jacob so much is that Jacob has a
knack of pricking Heathfield's vanity and getting to the heart of his
bluster and nonsense.

 
Reply With Quote
 
Huibert Bol
Guest
Posts: n/a
 
      08-16-2008
James Kuyper wrote:

> If C90 didn't have "allocated" storage duration, how were the corresponding
> concepts described in C90?


This was addressed in DR138, the real question is: does this make it part
of the offical standard.

--
Huibert
"Okay... really not something I needed to see." --Raven
 
Reply With Quote
 
Barry Schwarz
Guest
Posts: n/a
 
      08-16-2008
On Sat, 16 Aug 2008 09:02:11 -0700 (PDT), (E-Mail Removed) wrote:

>what is the difference between the tree storage
>durations(static,automatic and dynamic) in C?


google for n1256 and read the reference yourself rather than depend on
others quoting or paraphrasing the standard, perhaps erroneously. Keep
it around to answer your next homework question also.

Then if you have a question about the meaning of a particular section,
ask here and many will be glad to describe what it means to them.

--
Remove del for email
 
Reply With Quote
 
s0suk3@gmail.com
Guest
Posts: n/a
 
      08-16-2008
On Aug 16, 1:55*pm, Richard Heathfield <(E-Mail Removed)> wrote:
> (E-Mail Removed) said:
>
>
>
> > On Aug 16, 11:55 am, Richard Heathfield <(E-Mail Removed)> wrote:
> >> jacob navia said:

>
> >> <snip>

>
> >> > This is wrong. Heathfield lives in the past so it is using a
> >> > standard that is no longer current.

>
> >> No, Heathfield lives in the real world where almost no conforming C99
> >> implementations exist, but where almost every platform in existence is
> >> targetted by at least one of the very many conforming C90
> >> implementations. Heathfield refuses to live in a fantasy land in which
> >> the pretence is made that non-portable constructs will work everywhere
> >> just because ISO says that they are "standard".

>
> > How is that relevant in regard to what jacob said?

>
> He claimed I was living in the past. I'm not. I'm living in the present.
> He, on the other hand, appears to be living in hope.
>


In hope of what?

> > He said the
> > standard you referred to is no longer current.

>
> Yes, he did, and yes, he's de jure right. But he's de facto wrong.
>


Either he's right (which he is), or he's not. What do you mean by "de
facto"?

> > Whether C99 is portable
> > is another matter, which is rather pointless to discuss with you,

>
> I suppose it depends on what you mean by "portable". If by "portable" you
> mean "implementations exist for four or five platforms",


I don't know exactly which platforms are supported by C99
implementations, but let's name five (random) platforms for
illustration:

- Windows
- Linux
- Mac OS X
- Solaris
- HP-UX

By what I'd call "common standards," something that is portable among
that much platforms is very portable.

> then yes, of
> course C99 is portable. But if you mean "implementations exist for the
> vast majority of platforms", then I would argue that it isn't.
>


That in turn depends on what you mean by "the vast majority of
platforms." Do you mean "from microchips to supercomputers"? Or do you
mean "any popular OS"? I would expect most people in general to mean
the second.

> > but let's give it a try:

>
> > You say there are a lot more C90 implementations than there are C99
> > implementations, so C90 is more portable. That's true. But whether C99
> > is portable in *general* is something different, which is subject to
> > each person's definition and standards of portability. For people not
> > trying to run programs on toasters, C99 is surely portable enough.

>
> Do *you* use a conforming C99 implementation? You probably don't - but
> maybe, just maybe, you do. Most people, however, don't.
>


Like I've told you before, I use GCC's non-conforming C99
implementation. But the important thing is not so much the conformance
level, but the compiler's usability. For example, lcc-win doesn't
conform, but it has the most useful set of extensions I've ever seen
on any compiler. In contrast, the other day there was a discussion on
another group where someone said that, because of undefined behavior,
a program could erase all files in the hard disk. So a compiler could
generate instructions to erase all files in the hard disk whenever the
program it is compiling makes a construct that invokes undefined
behavior, and that compiler would still conform to the standard! So
you see, "conforming" != "perfect".

Sebastian

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Durations in Java JGralton@gmail.com Java 2 04-16-2008 11:26 AM
Exam Durations Marlin Munrow Microsoft Certification 1 05-08-2004 07:21 PM
Portable Storgae Option Matt Ziebarth Digital Photography 3 11-22-2003 12:52 PM



Advertisments