Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #34735

Re: How much memory does malloc(0) allocate?

From Phil Carmody <thefatphil_demunged@yahoo.co.uk>
Newsgroups comp.lang.c
Subject Re: How much memory does malloc(0) allocate?
Date 2013-08-01 15:57 +0300
Organization A noiseless patient Spider
Message-ID <87pptx7em3.fsf@bazspaz.fatphil.org> (permalink)
References (2 earlier) <kssmbq$n6p$1@dont-email.me> <ksu2lj$fqp$1@dont-email.me> <ksuc3f$usf$1@dont-email.me> <87y58o6zt8.fsf@bazspaz.fatphil.org> <kt89nk$bjv$2@dont-email.me>

Show all headers | View raw


Kleuske <kleuske@nowhere.net> writes:
> On Tue, 30 Jul 2013 14:40:35 +0300, Phil Carmody saw fit to publish the
> following:
> > Eric Sosman <esosman@comcast-dot-net.invalid> writes:
> >> On 7/26/2013 10:55 AM, Kleuske wrote:
> >> > On Thu, 25 Jul 2013 22:25:58 -0400, Eric Sosman saw fit to publish
> >> > the following:
> >> >
> >> >> On 7/25/2013 10:01 PM, Keith Thompson wrote:
> >> >>> Lynn McGuire <lmc@winsim.com> writes:
> >> >>>> How much memory does malloc(0) allocate?
> > ...
> >> > The "bytes > 0" check in the code above prevents ignominious crashes,
> >> > but masks a programming error. Memory isn't exhausted. Someone passed
> >> > a bad argument.
> >> 
> >>      The C99 Rationale (I haven't seen a C11 version yet) explains
> >> the Committee's thinking; see section 7.20.3.
> >> 
> >> > I would much prefer an solid assert instead.
> >> 
> >>      Fine -- But in your usage, the assert should precede the
> >> call to malloc(), and not depend on the returned value.
> > 
> > What's a "solid" assert? assert() is one of the most ephemeral bits of
> > code it's possible to write in C.
> 
> Sigh... That's the level of debate you prefer?

Let's start with clearly defined or otherwise unambiguous terms, and
see if we can progress from there.

Phil
-- 
If "law-abiding citizens have nothing to fear" from privacy-invading 
technologies and policies, then law-abiding governments should have
nothing to fear from whistleblowers.

Back to comp.lang.c | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

How much memory does malloc(0) allocate? Lynn McGuire <lmc@winsim.com> - 2013-07-25 19:23 -0500
  Re: How much memory does malloc(0) allocate? Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-07-25 21:14 -0400
  Re: How much memory does malloc(0) allocate? Barry Schwarz <schwarzb@dqel.com> - 2013-07-25 18:37 -0700
  Re: How much memory does malloc(0) allocate? Keith Thompson <kst-u@mib.org> - 2013-07-25 19:01 -0700
    Re: How much memory does malloc(0) allocate? Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-07-25 22:25 -0400
      Re: How much memory does malloc(0) allocate? Kleuske <kleuske@nowhere.net> - 2013-07-26 14:55 +0000
        Re: How much memory does malloc(0) allocate? Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-07-26 13:43 -0400
          Re: How much memory does malloc(0) allocate? Rosario1903 <Rosario@invalid.invalid> - 2013-07-26 20:54 +0200
            Re: How much memory does malloc(0) allocate? Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-07-26 15:08 -0400
            Re: How much memory does malloc(0) allocate? Bart van Ingen Schenau <bart@ingen.ddns.info.invalid> - 2013-07-27 08:52 +0000
              Re: How much memory does malloc(0) allocate? Rosario1903 <Rosario@invalid.invalid> - 2013-07-27 11:24 +0200
                Re: How much memory does malloc(0) allocate? Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-07-27 08:11 -0400
          Re: How much memory does malloc(0) allocate? Kleuske <kleuske@nowhere.net> - 2013-07-27 10:11 +0000
          Re: How much memory does malloc(0) allocate? Kleuske <kleuske@nowhere.net> - 2013-07-27 10:34 +0000
            Re: How much memory does malloc(0) allocate? Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-07-27 08:37 -0400
              Re: How much memory does malloc(0) allocate? Kleuske <kleuske@nowhere.net> - 2013-07-27 16:45 +0000
          Re: How much memory does malloc(0) allocate? Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2013-07-30 14:40 +0300
            Re: How much memory does malloc(0) allocate? Kleuske <kleuske@nowhere.net> - 2013-07-30 11:57 +0000
              Re: How much memory does malloc(0) allocate? Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2013-08-01 15:57 +0300
            Re: How much memory does malloc(0) allocate? David Thompson <dave.thompson2@verizon.net> - 2013-08-04 22:26 -0400
              Re: How much memory does malloc(0) allocate? Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-08-05 07:07 -0400
                Re: How much memory does malloc(0) allocate? Kleuske <kleuske@nowhere.net> - 2013-08-06 08:44 +0000
              Re: How much memory does malloc(0) allocate? Kleuske <kleuske@nowhere.net> - 2013-08-05 11:29 +0000
    Re: How much memory does malloc(0) allocate? Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2013-07-25 22:34 -0400
    Re: How much memory does malloc(0) allocate? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2013-07-26 03:39 -0700
      Re: How much memory does malloc(0) allocate? James Kuyper <jameskuyper@verizon.net> - 2013-07-26 07:58 -0400
        Re: How much memory does malloc(0) allocate? James Kuyper <jameskuyper@verizon.net> - 2013-07-26 13:27 -0400
          Re: How much memory does malloc(0) allocate? Rosario1903 <Rosario@invalid.invalid> - 2013-07-26 20:32 +0200
          Re: How much memory does malloc(0) allocate? Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-07-26 15:06 -0400
            Re: How much memory does malloc(0) allocate? James Kuyper <jameskuyper@verizon.net> - 2013-07-26 15:12 -0400
      Re: How much memory does malloc(0) allocate? Ike Naar <ike@faeroes.freeshell.org> - 2013-07-26 12:26 +0000
    Re: How much memory does malloc(0) allocate? christian.bau@cbau.wanadoo.co.uk - 2013-07-26 04:30 -0700
    Re: How much memory does malloc(0) allocate? Lynn McGuire <lmc@winsim.com> - 2013-07-26 09:57 -0500
    Re: How much memory does malloc(0) allocate? Keith Thompson <kst-u@mib.org> - 2013-07-26 09:30 -0700
      Re: How much memory does malloc(0) allocate? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2013-07-26 16:17 -0700
      Re: How much memory does malloc(0) allocate? Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2013-07-26 20:23 -0600
        Re: How much memory does malloc(0) allocate? James Kuyper <jameskuyper@verizon.net> - 2013-07-26 23:55 -0400
  Re: How much memory does malloc(0) allocate? Siri Cruise <chine.bleu@yahoo.com> - 2013-07-26 04:27 -0700
  Re: How much memory does malloc(0) allocate? Rosario1903 <Rosario@invalid.invalid> - 2013-07-26 19:33 +0200
    Re: How much memory does malloc(0) allocate? Rosario1903 <Rosario@invalid.invalid> - 2013-07-26 20:32 +0200
  Re: How much memory does malloc(0) allocate? "Heinrich Wolf" <invalid@invalid.invalid> - 2013-07-28 12:35 +0200
    Re: How much memory does malloc(0) allocate? James Kuyper <jameskuyper@verizon.net> - 2013-07-28 09:01 -0400
      Re: How much memory does malloc(0) allocate? Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-07-28 09:46 -0400
        Re: How much memory does malloc(0) allocate? Geoff <geoff@invalid.invalid> - 2013-07-28 11:33 -0700
          Re: How much memory does malloc(0) allocate? Keith Thompson <kst-u@mib.org> - 2013-07-28 12:38 -0700
          Re: How much memory does malloc(0) allocate? Richard Damon <Richard@Damon-Family.org> - 2013-07-28 15:44 -0400
          Re: How much memory does malloc(0) allocate? Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-07-28 16:01 -0400
          Re: How much memory does malloc(0) allocate? James Kuyper <jameskuyper@verizon.net> - 2013-07-28 16:16 -0400
  Re: How much memory does malloc(0) allocate? BGB <cr88192@hotmail.com> - 2013-07-28 15:59 -0500
    Re: How much memory does malloc(0) allocate? Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-07-28 18:09 -0400
      Re: How much memory does malloc(0) allocate? BGB <cr88192@hotmail.com> - 2013-07-28 19:15 -0500
        Re: How much memory does malloc(0) allocate? Richard Damon <Richard@Damon-Family.org> - 2013-07-28 20:37 -0400
          Re: How much memory does malloc(0) allocate? Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-07-28 20:39 -0400
          Re: How much memory does malloc(0) allocate? BGB <cr88192@hotmail.com> - 2013-07-28 21:31 -0500
        Re: How much memory does malloc(0) allocate? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2013-07-29 03:53 -0700
          Re: How much memory does malloc(0) allocate? BGB <cr88192@hotmail.com> - 2013-07-29 11:53 -0500
      Re: How much memory does malloc(0) allocate? Robert Wessel <robertwessel2@yahoo.com> - 2013-07-28 19:18 -0500
        Re: How much memory does malloc(0) allocate? Lynn McGuire <lmc@winsim.com> - 2013-07-29 14:42 -0500
          Re: How much memory does malloc(0) allocate? James Kuyper <jameskuyper@verizon.net> - 2013-07-29 16:22 -0400
          Re: How much memory does malloc(0) allocate? James Kuyper <jameskuyper@verizon.net> - 2013-07-29 16:29 -0400
            Re: How much memory does malloc(0) allocate? Keith Thompson <kst-u@mib.org> - 2013-07-29 14:59 -0700
              Re: How much memory does malloc(0) allocate? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2013-07-30 01:18 +0000
                Re: How much memory does malloc(0) allocate? Keith Thompson <kst-u@mib.org> - 2013-07-29 18:58 -0700
                Re: How much memory does malloc(0) allocate? Geoff <geoff@invalid.invalid> - 2013-07-29 20:24 -0700
                Re: How much memory does malloc(0) allocate? Malcolm McLean <malcolm.mclean5@btinternet.com> - 2013-07-30 02:34 -0700
                Re: How much memory does malloc(0) allocate? James Kuyper <jameskuyper@verizon.net> - 2013-07-30 07:42 -0400
                Re: How much memory does malloc(0) allocate? "James Harris \(es\)" <james.harris.1@gmail.com> - 2013-07-30 13:02 +0100
                Re: How much memory does malloc(0) allocate? BGB <cr88192@hotmail.com> - 2013-07-30 13:13 -0500
                Re: How much memory does malloc(0) allocate? Ian Collins <ian-news@hotmail.com> - 2013-07-31 07:44 +1200
                Re: How much memory does malloc(0) allocate? Keith Thompson <kst-u@mib.org> - 2013-07-30 14:33 -0700
                Re: How much memory does malloc(0) allocate? Lynn McGuire <lmc@winsim.com> - 2013-07-30 12:11 -0500
                Re: How much memory does malloc(0) allocate? glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2013-07-30 21:57 +0000
                Re: How much memory does malloc(0) allocate? James Kuyper <jameskuyper@verizon.net> - 2013-07-30 18:02 -0400
          Re: How much memory does malloc(0) allocate? Ike Naar <ike@ukato.freeshell.org> - 2013-07-29 21:50 +0000

csiph-web