473,886 Members | 2,519 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Storgae durations

what is the difference between the tree storage
durations(stati c,automatic and dynamic) in C?
Aug 16 '08
241 7053
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.

Aug 16 '08 #11
On Sat, 16 Aug 2008 09:02:11 -0700 (PDT), jr******@gmail. com wrote:
>what is the difference between the tree storage
durations(stat ic,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
Aug 16 '08 #12
s0****@gmail.co m said:
On Aug 16, 11:55 am, Richard Heathfield <r...@see.sig.i nvalidwrote:
>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
implementation s exist, but where almost every platform in existence is
targetted by at least one of the very many conforming C90
implementation s. 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.
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.
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 "implementation s exist for four or five platforms", then yes, of
course C99 is portable. But if you mean "implementation s exist for the
vast majority of platforms", then I would argue that it isn't.
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.

--
Richard Heathfield <http://www.cpax.org.uk >
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Aug 16 '08 #13
James Kuyper said:
Richard Heathfield wrote:
>jr******@gmail. com said:
>>what is the difference between the tree storage
durations(sta tic,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" ,
Yes. I have already accepted that correction elsethread.

<snip>
If C90 didn't have "allocated" storage duration, how were the
corresponding concepts described in C90?
See my other reply.

--
Richard Heathfield <http://www.cpax.org.uk >
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Aug 16 '08 #14
On Aug 16, 1:55*pm, Richard Heathfield <rj*@see.sig.in validwrote:
s0****@gmail.co m said:
On Aug 16, 11:55 am, Richard Heathfield <rj*@see.sig.in validwrote:
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 "implementation s 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 "implementation s 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

Aug 16 '08 #15
s0****@gmail.co m said:
Richard Heathfield wrote:
>s0****@gmail.co m said:
Richard Heathfield 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
implementation s exist, but where almost every platform in existence
is targetted by at least one of the very many conforming C90
implementation s. 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?
C99, presumably.
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.
He's right only in a completely useless and almost meaningless way.
What do you mean by "de facto"?
"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. De jure, C99
is the C Standard. De facto, C90 is the C Standard.
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 "implementation s exist for four or five platforms",

I don't know exactly which platforms are supported by C99
implementations ,
Then you are in no position to make an argument about C99's portability or
otherwise.
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.
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.
>then yes, of
course C99 is portable. But if you mean "implementation s 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.
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 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.
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.
But the important thing is not so much the conformance
level,
The important thing to you, maybe - but here, we discuss ISO C, not
notquiteISO C.
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.
If it doesn't implement the language correctly, the extensions are a moot
point.
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.
Yes, that is one legal outcome of undefined behaviour.
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!
Yes.
So you see, "conforming " != "perfect".
You seem to be arguing that it's the compiler's fault if the program is
incorrectly written. I don't agree.

--
Richard Heathfield <http://www.cpax.org.uk >
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Aug 16 '08 #16
Huibert Bol wrote:
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.
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.
Aug 16 '08 #17
On Sat, 16 Aug 2008 19:54:07 +0000, Richard Heathfield wrote:
s0****@gmail.co m said:
>I don't know exactly which platforms are supported by C99
implementation s,

Then you are in no position to make an argument about C99's portability
or otherwise.
>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.

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 .
Aug 16 '08 #18
Richard Heathfield wrote:
s0****@gmail.co m said:
>I don't know exactly which platforms are supported by C99
implementation s,

Then you are in no position to make an argument about C99's
portability or otherwise.
>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.

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.
>>then yes, of
course C99 is portable. But if you mean "implementation s 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.

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.
>But the important thing is not so much the conformance
level,

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>

Aug 16 '08 #19
On Aug 16, 2:54*pm, Richard Heathfield <rj*@see.sig.in validwrote:
s0****@gmail.co m said:
Richard Heathfield wrote:
s0****@gmail.co m said:
Richard Heathfield 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?

C99, presumably.
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.

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.
What do you mean by "de facto"?

"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.
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 "implementation s exist for four or five platforms",
I don't know exactly which platforms are supported by C99
implementations ,

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

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.
then yes, of
course C99 is portable. But if you mean "implementation s 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.

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

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"?
But the important thing is not so much the conformance
level,

The important thing to you, maybe - but here, we discuss ISO C, not
notquiteISO C.
I'm not discussing "notquiteIS O C." I'm stating that the important
thing is not so much the conformance level, but the compiler's
usability.
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.

If it doesn't implement the language correctly, the extensions are a moot
point.
That's your opinion (and apparently only yours).
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.

Yes, that is one legal outcome of undefined behaviour.
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!

Yes.
So you see, "conforming " != "perfect".

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

Aug 16 '08 #20

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
6741
by: Robert | last post by:
Is there a way to determine why the Textdata field has "NULL" for a value. The trace shows multiple "NULL" value records with the longest durations; many greater than 50,000ms. The {} indicate the TextData and Duration on the line below: rownumber | textdata | Eventclass | ......| Duration |... 966 | 15 | {NULL} | 24 smm5413 | 808 | Microsoft Office XP | misview012 | 78 | {604636} | 2004-02-11 15:25:12.010 | 4747 | 0 | 469
3
3757
by: Ant | last post by:
Hi, I need to find out what data types I need to work with time durations & how to add/subtract them from clock time. For example: A customer logs in at 7:30 in the morning. I need notification 40 minutes after the custmer has logged in. (at 8:10). It needs to work with 24 hour time as well. Is there a data type that acts as daily time? I know datetime but how would use that in this situation. Many thanks for your ideas Ant
1
5193
by: John Bailo | last post by:
I'm doing a profile on my SQL Server to see if I can eliminate any long running statements, and periodically, I see an entry for ".NET SqlClient Data Provider". The durations for it are very long, the example below shows 386 seconds! I would think that whatever these are they are "gumming up" my database server. However, there is nothing in the Text Data field to help me identify the source! Does anyone else get this showing up...
2
2198
by: PWS | last post by:
Hi all, I developed an online learning website where each student has his own username/password and they can view course materials and take tests online. I did that in PHP and PostgreSQL. Now, I need to implement a function that I don't seem to be doing right. A course has multiple modules under it and a module has several pages, all are done in PHP. I am required to log the times (durations) each student spends on a module. Duration...
0
9799
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11172
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10429
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9592
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7987
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7139
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6010
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4627
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3245
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.