Storgae durations

J

jrdacc.i

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

Ben Bacarisse

Richard Heathfield said:
(e-mail address removed) said:


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?
 
J

jacob navia

Richard said:
(e-mail address removed) said:


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.
 
S

s0suk3

jacob navia said:



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
 
A

Antoninus Twink

jacob navia said:

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.
 
J

James Kuyper

Richard said:
(e-mail address removed) said:


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?
 
A

Antoninus Twink

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.
 
H

Huibert Bol

James said:
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.
 
B

Barry Schwarz

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.
 
S

s0suk3

(e-mail address removed) 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?
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"?
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.
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
 
J

James Kuyper

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

What do you mean by that question? It most certainly already is a part
of the official standard: 6.2.4p1: "There are three storage durations:
static, automatic, and allocated."

It's arguably the case that C99 is not the de facto standard, but it is
most certainly the official standard.
 
H

Harald van Dijk

(e-mail address removed) said:

Then you are in no position to make an argument about C99's portability
or otherwise.


I think the OS390 and VM/CMS folks might cough and splutter a bit if
they heard you say that. But since you don't actually know whether the
platforms you name have C99 implementations available for them, your
point lacks force.

Intel's compiler is available for Windows and Linux, and the other three
conform to SUSv3. In other words, the platforms all have conforming C99
implementations.
 
S

santosh

Richard said:
(e-mail address removed) said:

Then you are in no position to make an argument about C99's
portability or otherwise.


I think the OS390 and VM/CMS folks might cough and splutter a bit if
they heard you say that. But since you don't actually know whether the
platforms you name have C99 implementations available for them, your
point lacks force.


I would certainly include mainframes and mid-range computers, which
you seem to have ignored completely. I would also include the more
powerful DSPs, the kind you find in home entertainment hardware
(set-top boxes, DVD players, etc). It is easy to dismiss these, but
they are powerful enough to run email clients, Web browsers, all kinds
of cool stuff. Not a market one ought to dismiss too easily.

But how often is it the case that a single application needs to be
portable across mainframes, desktops, and DSPs? Subroutines could
easily port across all these (depending of course on what exactly the
routine does), but I have yet to encounter a complete, real world,
application that ports without modification to all these diverse
systems.
The important thing to you, maybe - but here, we discuss ISO C, not
notquiteISO C.

Actually to me, both you and Sebastian seem to be arguing for the
utility of non-ISO C. :)

<snip>
 
S

s0suk3

(e-mail address removed) said:





C99, presumably.



He's right only in a completely useless and almost meaningless way.

How can someone be right in a meaningless way? Again, either someone
is right, or not. It's *that* simple.
"de jure": in law.
"de facto": in reality.

A government passes a law that as of now, nobody may breathe. De jure,
people no longer breathe. De facto, however, they still do.

In other words, they are committing a crime. I fail to see how that
relates to what we're discussing here.
De jure, C99
is the C Standard. De facto, C90 is the C Standard.

They're both C standards; the latter is the *current* standard; is
that so hard to understand for you? Maybe, like Twink said, you'd
rather ignore the current standard. In any case, your above statement
makes no sense whatsoever.
Then you are in no position to make an argument about C99's portability or
otherwise.

I am if my standards of portability comprise an implementation being
portable among a number of fairly popular and widely used OSs, and if
there are implementations for C99 that target those platforms.
I think the OS390 and VM/CMS folks might cough and splutter a bit if they
heard you say that.

Surely, they probably have different opinions on portability.
But since you don't actually know whether the
platforms you name have C99 implementations available for them, your point
lacks force.

Again:

Not if my standards of portability comprise an implementation being
portable among a number of fairly popular and widely used OSs, and if
there are implementations for C99 that target those platforms.
I would certainly include mainframes and mid-range computers, which you
seem to have ignored completely.

Yes, because they are of no interest to me.
I would also include the more powerful
DSPs, the kind you find in home entertainment hardware (set-top boxes, DVD
players, etc). It is easy to dismiss these, but they are powerful enough
to run email clients, Web browsers, all kinds of cool stuff. Not a market
one ought to dismiss too easily.



So no, then. If C99 isn't even portable to *your* desktop, it is hard to
see how you can sustain a claim to general portability.

I use C99 for my desktop. Where do you get that "C99 isn't even
portable to my desktop"?
The important thing to you, maybe - but here, we discuss ISO C, not
notquiteISO C.

I'm not discussing "notquiteISO C." I'm stating that the important
thing is not so much the conformance level, but the compiler's
usability.
If it doesn't implement the language correctly, the extensions are a moot
point.

That's your opinion (and apparently only yours).
Yes, that is one legal outcome of undefined behaviour.


You seem to be arguing that it's the compiler's fault if the program is
incorrectly written. I don't agree.

It's the compiler's decision what to do when a has something in it
invokes undefined behavior. If a compiler does what I mentioned above
in a case where a program does something that invokes undefined
behavior, I'd deem that compiler useless.

Sebastian
 
J

jacob navia

Richard said:
(e-mail address removed) said:

Then you are in no position to make an argument about C99's portability or
otherwise.


I think the OS390 and VM/CMS folks might cough and splutter a bit if they
heard you say that.

Heathfield is again speaking pure nonsense.

C99 is available for the z/VM operating system
(IBM Mainframes).

http://www-306.ibm.com/software/awdtools/czvm/

<quote>
Supports the ISO/IEC 9899:1999 international standard (C99)
<end quote>

IBM supports C99 in all its mainline compilers

The fact that Heathfield doesn't know what he is speaking about
doesn't mean that there isn't any C99 compiler for that platform.
 
I

Ian Collins

Richard said:
(e-mail address removed) said:

Then you are in no position to make an argument about C99's portability or
otherwise.


I think the OS390 and VM/CMS folks might cough and splutter a bit if they
heard you say that. But since you don't actually know whether the
platforms you name have C99 implementations available for them, your point
lacks force.
How do you know that?
So no, then. If C99 isn't even portable to *your* desktop, it is hard to
see how you can sustain a claim to general portability.
How do you know that? How do you know he doesn't use one of the 5
platforms he mentions, but prefers gcc?
The important thing to you, maybe - but here, we discuss ISO C, not
notquiteISO C.
Which is why I prefer to use 'c99' on my platform of choice.

If I'm developing code for a small embedded target or updating a library
component, I'll stick with 'c89'. Portability is relative, most code I
write these days is portable within POSIX systems, so C99 if a fair choice.
 
J

jacob navia

Richard said:
The important thing to you, maybe - but here, we discuss ISO C, not
notquiteISO C.

Yes, sure.

But with ISO C you do not mean ISO C, but an
obsolete version of ISO C that suits your tastes.

So, here, you say, "we" discuss whatever
"you" like.

GREAT Heathfield.
 
A

Antoninus Twink

Intel's compiler is available for Windows and Linux, and the other
three conform to SUSv3. In other words, the platforms all have
conforming C99 implementations.

I don't believe for a second that Heathfield wasn't fully aware of that.

He's a proven liar who chooses to spread FUD about the current C
standards for his own reasons.
 
J

jacob navia

Antoninus said:
I don't believe for a second that Heathfield wasn't fully aware of that.

He's a proven liar who chooses to spread FUD about the current C
standards for his own reasons.

He said that C99 wasn't available for IBM mainframes, what
is a lie. See:

http://www-306.ibm.com/software/awdtools/czvm/

<quote>
Supports the ISO/IEC 9899:1999 international standard (C99)
<end quote>
 
A

Antoninus Twink

But how often is it the case that a single application needs to be
portable across mainframes, desktops, and DSPs? Subroutines could
easily port across all these (depending of course on what exactly the
routine does), but I have yet to encounter a complete, real world,
application that ports without modification to all these diverse
systems.

An extremely sensible and well-made point, and one that flies in the
face of the clc "regulars'" main dogma.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top