473,842 Members | 1,804 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 7043
On Aug 16, 3:47 pm, santosh <sa*********@gm ail.comwrote:
s0****@gmail.co m wrote:
On Aug 16, 2:54 pm, Richard Heathfield <rj*@see.sig.in validwrote:
s0****@gmail.co m said:
Richard Heathfield wrote:

<snip>
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"?

Presumably from your statement above that you use GCC's non-conforming
C99 implementation.
The question remains: Where does he get that "C99 isn't even portable
to my desktop"?
Richard does have a point, IMO. Even some WG14 Committee members have
mentioned in this group (or in comp.std.c) that C99 has been
implemented completely by a dramatically smaller number of vendors than
the Committee had anticipated prior to the Standard's release. This
observation has resulted in the Manifesto for C1x to explicitly
discourge so-called Committee inventions unless there exist a
reasonable number of existing implementations .
I've been wondering, if C99 has been implemented only by a small
number of vendors so far, the reason seeming to be that they're not
interested in C anymore, *who* is going to implement C1X?
Most C compilers seem to have implement *parts* of C99 but only a few
have implemented it in it's entirety. This means that you have to be
far more circumspect when trying to write a maximally portable C99
program than a C90 one, so much so, that you might find yourself coding
in the subset of C99 that corresponds almost exactly to C90.
Not if your code needs to portable among OSs where there are C99
implementations , which I would expect to be the case of most people.
Isn't that your case too?

<snip>

Sebastian

Aug 16 '08 #31
Huibert Bol wrote:
James Kuyper wrote:
>>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."

Sorry, I meant what was the status with regard to the (then, 1994)
standard? RRs seem to live in a sort of limbo until the standard gets
updated, which, in this case, never happened.
I believe that the RRs that are published can be taken
as "clarifications " to the current Standard, but they are not
normative.

Aug 16 '08 #32
s0****@gmail.co m wrote:
On Aug 16, 3:47 pm, santosh <sa*********@gm ail.comwrote:
>s0****@gmail.co m wrote:
On Aug 16, 2:54 pm, Richard Heathfield <rj*@see.sig.in validwrote:
s0****@gmail.co m said:
Richard Heathfield wrote:

<snip>
>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"?

Presumably from your statement above that you use GCC's
non-conforming C99 implementation.

The question remains: Where does he get that "C99 isn't even portable
to my desktop"?
Okay, let's leave this point.
>Richard does have a point, IMO. Even some WG14 Committee members have
mentioned in this group (or in comp.std.c) that C99 has been
implemented completely by a dramatically smaller number of vendors
than the Committee had anticipated prior to the Standard's release.
This observation has resulted in the Manifesto for C1x to explicitly
discourge so-called Committee inventions unless there exist a
reasonable number of existing implementations .

I've been wondering, if C99 has been implemented only by a small
number of vendors so far, the reason seeming to be that they're not
interested in C anymore, *who* is going to implement C1X?
This is a fair question, and something I think that many programmers
might well wonder about, given C99's adoption rate. To the Committee's
credit, they do seem to be aware of this and seem determined to
minimise changes and additions.

Personally, I think an important determinant of C1x's success will be
it's extent of compatibility with C++0x. Apparently WG14 and WG21
collaborate closely in areas where their activities will affect the
other. A Standard that is highly compatible with C++0x will probably be
implemented fairly enthusiasticall y.
>Most C compilers seem to have implement *parts* of C99 but only a few
have implemented it in it's entirety. This means that you have to be
far more circumspect when trying to write a maximally portable C99
program than a C90 one, so much so, that you might find yourself
coding in the subset of C99 that corresponds almost exactly to C90.

Not if your code needs to portable among OSs where there are C99
implementations , which I would expect to be the case of most people.
Isn't that your case too?

<snip>
Yes, but there *are* a lot of developers working in the embedded arena
where C99 is not implemented as well as C90.

Aug 16 '08 #33
s0****@gmail.co m wrote:
>
I've been wondering, if C99 has been implemented only by a small
number of vendors so far, the reason seeming to be that they're not
interested in C anymore, *who* is going to implement C1X?
Oh there's plenty of interest in C, but don't forget the majority of C
is written for embedded platforms that have no use for many C99 features
(_Complex on an 8 bit micro anyone?). I'd wager a decent quantity of
beer on the percentage of C programmers who have used <complex.hor
<tgmath.hin production code is vanishingly small.

--
Ian Collins.
Aug 16 '08 #34
Ben Bacarisse wrote:
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?
In C89, allocated duration is just a feature of the library.
Most features of the library don't need to be described
in the language section of the standard.

In C99, the only thing about allocated duration
that is a feature of the C language proper,
is the existence of allocated duration.
Everything else about allocated duration,
is described in the library section of the standard.

--
pete
Aug 17 '08 #35
jacob navia <ja***@nospam.c omwrites:
[...]
He said that C99 wasn't available for IBM mainframes, what
is a lie.
(referring to Richard Heathfield)
See:

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

<quote>
Supports the ISO/IEC 9899:1999 international standard (C99)
<end quote>
Assuming you're referring to what Richard wrote in this thread, I
suggest you read it again. He *didn't say* that C99 isn't available
for IBM mainframes.

And even if he had, apparently it didn't occur to you that he might
not have known about that web page.

I am sick and tired of the way you throw the words "lie" and "liar"
around.

Grow up.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Aug 17 '08 #36
Ian Collins wrote:
s0****@gmail.co m wrote:
>>
I've been wondering, if C99 has been implemented only by a small
number of vendors so far, the reason seeming to be that they're not
interested in C anymore, *who* is going to implement C1X?
Oh there's plenty of interest in C, but don't forget the majority of C
is written for embedded platforms that have no use for many C99
features (_Complex on an 8 bit micro anyone?). I'd wager a decent
quantity of beer on the percentage of C programmers who have used
<complex.hor <tgmath.hin production code is vanishingly small.
Then I wonder why the Committee standardised them in the first place? It
seemingly flies against their own charter for C99.

On a related note, I note that the Committee is considering the
possibility of sectioning the Standard for it's next incarnation. If
it's embraced then the maths and scientific functions could be included
in a "Scientific C" subset.

Aug 17 '08 #37
jacob navia said:
Antoninus Twink wrote:
>On 16 Aug 2008 at 20:06, Harald van D?k wrote:
>>On Sat, 16 Aug 2008 19:54:07 +0000, Richard Heathfield wrote:
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 .

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,
No, I didn't. Learn to read, please.
what is a lie.
It is especially important to learn to read if it will help you to avoid
hurling silly insults around. What I said was no lie. Read it again.

Since Keith has already made both those points, however, let's move on and
make a third one, shall we?
See:

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

<quote>
Supports the ISO/IEC 9899:1999 international standard (C99)
<end quote>
Yes, there are lots of implementations that "support" C99 to a greater or
lesser extent. I see no hard evidence that the implementation you mention
even *claims* C99 conformance, however. Perhaps I missed it, in which case
no doubt you can point out where the conformance claim is made.

--
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 17 '08 #38
Richard Heathfield wrote:
jacob navia said:
>Antoninus Twink wrote:
>>On 16 Aug 2008 at 20:06, Harald van D?k wrote:
On Sat, 16 Aug 2008 19:54:07 +0000, Richard Heathfield wrote:
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 .
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,

No, I didn't. Learn to read, please.
You said that there was no C99 for S390.

IBM renamed S390 to z Series systems
--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
Aug 17 '08 #39
s0****@gmail.co m said:
Richard Heathfield wrote:
>s0****@gmail.co m said:
Richard Heathfield wrote:
s0****@gmail.co m said:
<snip>
>>
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?
It's not difficult, but someone can also be wrong in meaningless ways...
Again, either someone is right, or not. It's *that* simple.
....and that's a good example.
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.
Look, I feel like I'm arguing with a complete idiot, and you're going to
have to work pretty hard to change my mind. You *ASKED* for an explanation
of "de facto", and I gave you one, complete with an illustration. What's
more, it is clear that the distinction is highly relevant.

*IN LAW*, C99 is the current Standard. *IN PRACTICE*, here you are,
advocating C99 and saying that C90 is obsolete, but according to your last
article you don't even have a conforming C99 implementation on your
desktop machine!
>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;
De jure, C99 is the C Standard. De facto, C90 is the C Standard.

Is that so hard to understand for you? I mean, I know you struggled with
the terminology, but I have now explained that. Do you *have* to struggle
with the common sense, too? Are you really so foolish as to believe
there's any point in trying to write code that adheres to a Standard to
which not even your own implementation conforms?

<snip>
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.
That's a lot of ifs.
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.
The ones I've worked with are red-hot on portability. I've done a lot of
work on OS390 projects, and normal practice is to write it on the PC, get
it working, then put it straight up on the mainframe for testing. The
ideal is for no code changes to be required on the mainframe - this is
rarely attained, but any such changes that do turn out to be necessary are
made *ON THE PC*, tested there, and then ported up.
>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.
Again, that's a lot of ifs. You're talking through your nose and hoping
that the facts support you, instead of checking and presenting the facts.
>
>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.
Well, there's a shock. Nevertheless, there's a lot more to life than Vista.

<snip>
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.
That's a change from your last article, where you claimed you did not use
C99 for your desktop. I don't count non-conforming implementations , since
they don't implement C99.
Where do you get that "C99 isn't even portable to my desktop"?
From your own claim that you don't use a C99 implementation.
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."
That's exactly what you're discussing, when you talk about non-conformiong
implementations .
I'm stating that the important
thing is not so much the conformance level, but the compiler's
usability.
Usability is important, but rarely an issue. Compilers are normally pretty
easy to use. But if the implementation *doesn't conform*, then you can't
trust it to run code that wasn't tailored specifically for it.
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).
I think you'll find a wide body of support for the opinion that compilers
ought to be able to translate programs according to spec, if only you're
prepared to take your blinkers off.

<snip>
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.
Actually, very often the compiler *doesn't* make that decision. For
example, consider the following code:

void foo(unsigned int *a, unsigned int *b)
{
*a += ++*b;
}

This code is standalone, in the sense that one could legally compile it as
a separate translation unit. Do you see any reason why a compiler should
decide to insert extra instructions into this function's translated code
to guard against undefined behaviour, especially when the compiler has no
reason to believe that the function will ever be invoked incorrectly?
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.
At the very least, it would be a valuable teaching tool.

--
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 17 '08 #40

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

Similar topics

1
6732
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
9709
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
10934
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
10609
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10303
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
9446
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
7853
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
7025
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();...
1
4498
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
2
4085
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.