From: malc <av1474@comtv.ru>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org, Aurelien Jarno <aurelien@aurel32.net>
Subject: Re: [Qemu-devel] [PATCH] loader: don't call realloc(O) when no symbols are present
Date: Thu, 21 Jan 2010 22:04:26 +0300 (MSK) [thread overview]
Message-ID: <Pine.LNX.4.64.1001212159540.3045@linmac.oyster.ru> (raw)
In-Reply-To: <m3k4vb47qy.fsf@blackfin.pond.sub.org>
On Thu, 21 Jan 2010, Markus Armbruster wrote:
> malc <av1474@comtv.ru> writes:
>
> > On Thu, 21 Jan 2010, Markus Armbruster wrote:
[..snip..]
> >> No, this is a misinterpretation of the C99 standard, made possible by
> >> its poor wording. The C99 Rationale is perfectly clear, though:
> >
> > You have to show the flaw in Hallvard B Furuseth's analysis to claim
> > that it's a misinterpretation. And unlike the standard rationale is
> > non normative.
> >
> > [..snip..]
>
> I did. If that doesn't convince you, I'll gladly wait for the Technical
> Corrigendum that'll put this rather absurd misreading to rest.
If you did, then, i guess, i've missed it, here's the whole analysis,
please point what and where is wrong:
[quote: http://groups.google.com/group/comp.std.c/browse_thread/thread/4e9af8847613d71f/6f75ad22e0768a0b?q=realloc++group:comp.std.c#6f75ad22e0768a0b]
C90 said realloc(non-null, 0) did free(). C99 inverted that, saying it
does not:
The only place where 7.20.3.4 (The realloc function) mentions that
realloc may free the old object, is in the case where it returns another
object. 7.20.3 (Memory management functions) says zero-sized allocation
returns NULL, but 7.20.3.4 overrides that.
Could we have the original behavior back, please? I've seen people say
the current definition is unintentional. And it conflicts with the C99
Rationale:
7.20.3.4 The realloc function
(...) If the first argument is not null, and the second argument is
0, then the call frees the memory pointed to by the first argument,
though that goes on with
and a null argument may be returned; C99 is consistent with the
policy of not allowing zero-sized objects.
Is that supposed to mean no new object is returned but the return value
is indeterminate, or does it mean that it might free the old object and
return an inaccessible new object like malloc(0)?
Repeating from old realloc(non-null, 0) discussions:
In the latter case a program which sees a NULL return from
realloc(non-null, 0) cannot know if the old object was freed or not -
i.e. it cannot know if the NULL was a failure return (from allocating
the new object) or a success return (after freeing the old object).
Which is exactly the situation for a portable program which sees such a
NULL return today - it cannot know if it was a C99 failure return or a
C90 success return. Even if the language is C99, the library might be
C90.
[end quote]
--
mailto:av1474@comtv.ru
next prev parent reply other threads:[~2010-01-21 19:04 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20091228134949.GC4908@volta.aurel32.net>
[not found] ` <20091228145325.GA7139@shareable.org>
[not found] ` <Pine.LNX.4.64.0912282058310.2142@linmac.oyster.ru>
[not found] ` <20091229165007.GB18379@shareable.org>
[not found] ` <Pine.LNX.4.64.0912292316340.2155@linmac.oyster.ru>
2010-01-21 17:47 ` [Qemu-devel] [PATCH] loader: don't call realloc(O) when no symbols are present Markus Armbruster
2010-01-21 18:04 ` malc
2010-01-21 18:45 ` Markus Armbruster
2010-01-21 19:04 ` malc [this message]
2010-01-22 13:16 ` Markus Armbruster
2010-01-22 19:02 ` malc
2010-01-21 18:20 ` Jamie Lokier
2010-01-21 18:26 ` malc
2010-01-22 13:17 ` Markus Armbruster
2010-01-22 18:54 ` malc
2010-01-21 18:44 ` Markus Armbruster
2010-01-22 2:05 ` Jamie Lokier
2010-01-22 11:05 ` Markus Armbruster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.1001212159540.3045@linmac.oyster.ru \
--to=av1474@comtv.ru \
--cc=armbru@redhat.com \
--cc=aurelien@aurel32.net \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).