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


Groups > comp.lang.c++ > #70827

Re: What is the data structure of a NULL?

From David Brown <david.brown@hesbynett.no>
Newsgroups comp.lang.c++
Subject Re: What is the data structure of a NULL?
Date 2019-12-30 17:24 +0100
Organization A noiseless patient Spider
Message-ID <qud8c2$b3q$1@dont-email.me> (permalink)
References (7 earlier) <qubjcd$glg$1@dont-email.me> <slrnr0isv8.uul.nedlatham@woden.valhalla.oz> <87r20mpaxz.fsf@nosuchdomain.example.com> <qucfq2$737$1@dont-email.me> <slrnr0jnc4.vao.nedlatham@woden.valhalla.oz>

Show all headers | View raw


On 30/12/2019 12:20, Ned Latham wrote:
> David Brown wrote:
>> Keith Thompson wrote:
>>> Ned Latham writes:
>>>> James Kuyper wrote:
>>>>> Ned Latham wrote:
>>>>>> Keith Thompson wrote:
>>>>>>>
>>>>>>> You indicated that it's useful to know how a null pointer is
>>>>>>> represented.  How is it useful?  Most of the time, the representation
>>>>>>> doesn't matter.
>>>>>>
>>>>>> Knowing it's useful in that it enables me to use it.
>>>>>
>>>>> Can you give an example of code involving a null pointer that you could
>>>>> not have used if you had not known how null pointers are represented? I
>>>>> write code that deals correctly with null pointers all the time, and to
>>>>> the best of my knowledge, not a single line of code I've ever written
>>>>> would need a re-write if ported to a system which uses a different
>>>>> representation for null pointers.
>>>>
>>>> http://www.users.on.net/~nedlatham/Software/mclib/Documents/sourcecode.html
>>>>
>>>> Check AVLC and ListC, also read
>>>> http://www.users.on.net/~nedlatham/Software/mclib/Documents/mclists.html
>>>
>>> Can you give a *succinct* example?  I'm not going to spend the time it
>>> would take to read that.
>>>
>>
>> I had a quick look at the code - for the sake of your sanity, don't read
>> it.
> 
> Well, if you're not going to read any documentation, why bother indeed.

You didn't link to documentation - you linked to the source code.  The
source code was, of course, the important part for the discussion.  (I
found the document pages too.)

> 
>>      I don't know what language Ned is trying to use,
> 
> Using, David. mclib is a working C++ library. Has been for at least ten
> years.
> 

I only looked at the source code you linked - it is not complete,
because it is written in a sort-of C, sort-of C++, sort-of something
else mix using your own macros.

>>                                                       but it is not C++
>> as other people know it.
> 
> The documentation tells you that. And why.

No, it does not.

> 
>>                           (Hint - it is full of macros like WHILE and IF
>> and the like, which are not defined anywhere.
> 
> Don't be stupider than you have to be, David.

They are not defined in the source code you linked.  They are defined in
the file "mcdef.h", which was not in the links (it is in the tarball
that can be found by a little digging from your links).

There are few thinks more irritating to programmers than some nitwit who
thinks it helps to make one programming language look like another.
Macros to try to make your C or C++ code like BASIC are /not/ a good
idea, and never have been.


> 
>>                                                And you know how C++ has
>> templates so that you can write container classes in a clear, type-safe
>> and efficient manner rather than the simple but riskier and less
>> efficient C-style use of void* pointers everywhere?
> 
> The documentation would have told you that AVLC and ListC are designed to
> be totally independent of type (past, present and future). Pointers can do
> that; templates cannot. They're a code bloat idea, anyway.

Had you linked to the documentation, it would have told me that.  It
says nothing about /why/ that might be a useful idea.  (A reasonable
answer would be "the code is from 1995, when C++ compilers had limited
and inefficient support for templates".)


> 
>>                                                      And it has RAII for
>> convenient resource handling?  New and delete rather than malloc and
>> free?  Ned doesn't.)
> 
> Those are design decisions too, idiot. The C++ library throws exceptions.
> Exceptions are evil, especially in low-level code.

RAII is orthogonal to exceptions.  You can use one feature without the
other, though they work well together.

I can appreciate that your code was written before non-throwing "new"
was widely available.  Some of your design decisions are reasonable
enough for code from 1995 - but hardly examples of how to write C++ in
this generation.


> 
> And BTW, it's calloc(), not malloc(). Linux malloc() has a tendency to
> return "optimistic" pointers, which for my purposes is an unreliable
> behaviour.
> 

Yes, you mentioned that in your documentation.  It was one of many
incorrect statements.

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

What is the data structure of a NULL? T <T@invalid.invalid> - 2019-12-27 13:24 -0800
  Re: What is the data structure of a NULL? Ian Collins <ian-news@hotmail.com> - 2019-12-28 10:36 +1300
    Re: What is the data structure of a NULL? T <T@invalid.invalid> - 2019-12-27 13:55 -0800
      Re: What is the data structure of a NULL? Bo Persson <bo@bo-persson.se> - 2019-12-28 11:28 +0100
    Re: What is the data structure of a NULL? James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-12-27 20:50 -0500
      Re: What is the data structure of a NULL? T <T@invalid.invalid> - 2019-12-28 17:14 -0800
      Re: What is the data structure of a NULL? Tim Rentsch <tr.17687@z991.linuxsc.com> - 2020-01-10 20:56 -0800
  Re: What is the data structure of a NULL? "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2019-12-27 22:42 +0100
    Re: What is the data structure of a NULL? T <T@invalid.invalid> - 2019-12-27 13:55 -0800
      Re: What is the data structure of a NULL? "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2019-12-27 23:10 +0100
      Re: What is the data structure of a NULL? Öö Tiib <ootiib@hot.ee> - 2019-12-27 14:15 -0800
        Re: What is the data structure of a NULL? T <T@invalid.invalid> - 2019-12-27 14:24 -0800
          Re: What is the data structure of a NULL? Öö Tiib <ootiib@hot.ee> - 2019-12-27 14:41 -0800
          Re: What is the data structure of a NULL? Manfred <noname@add.invalid> - 2019-12-28 20:11 +0100
            Re: What is the data structure of a NULL? T <T@invalid.invalid> - 2019-12-28 17:16 -0800
              Re: What is the data structure of a NULL? Manfred <noname@invalid.add> - 2019-12-29 17:52 +0100
                Re: What is the data structure of a NULL? T <T@invalid.invalid> - 2019-12-29 12:21 -0800
      Re: What is the data structure of a NULL? Bart <bc@freeuk.com> - 2019-12-28 01:46 +0000
        Re: What is the data structure of a NULL? T <T@invalid.invalid> - 2019-12-28 17:17 -0800
          Re: What is the data structure of a NULL? Bart <bc@freeuk.com> - 2019-12-29 01:42 +0000
            Re: What is the data structure of a NULL? T <T@invalid.invalid> - 2019-12-28 18:39 -0800
  Re: What is the data structure of a NULL? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2019-12-28 02:14 -0800
    Re: What is the data structure of a NULL? Ned Latham <nedlatham@woden.valhalla.oz> - 2019-12-28 08:33 -0600
      Re: What is the data structure of a NULL? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2019-12-28 13:22 -0800
        Re: What is the data structure of a NULL? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2019-12-28 16:02 -0800
          Re: What is the data structure of a NULL? Ned Latham <nedlatham@woden.valhalla.oz> - 2019-12-28 22:37 -0600
        Re: What is the data structure of a NULL? Ned Latham <nedlatham@woden.valhalla.oz> - 2019-12-28 22:37 -0600
          Re: What is the data structure of a NULL? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2019-12-28 21:12 -0800
            Re: What is the data structure of a NULL? Ned Latham <nedlatham@woden.valhalla.oz> - 2019-12-29 04:45 -0600
              Re: What is the data structure of a NULL? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2019-12-29 13:31 -0800
                Re: What is the data structure of a NULL? Ned Latham <nedlatham@woden.valhalla.oz> - 2019-12-29 21:34 -0600
                Re: What is the data structure of a NULL? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2019-12-29 22:48 -0800
              Re: What is the data structure of a NULL? James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-12-29 20:20 -0500
                Re: What is the data structure of a NULL? Ned Latham <nedlatham@woden.valhalla.oz> - 2019-12-29 21:50 -0600
                Re: What is the data structure of a NULL? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2019-12-29 22:46 -0800
                Re: What is the data structure of a NULL? David Brown <david.brown@hesbynett.no> - 2019-12-30 10:25 +0100
                Re: What is the data structure of a NULL? Ned Latham <nedlatham@woden.valhalla.oz> - 2019-12-30 05:20 -0600
                Re: What is the data structure of a NULL? David Brown <david.brown@hesbynett.no> - 2019-12-30 17:24 +0100
                Re: What is the data structure of a NULL? Ned Latham <nedlatham@woden.valhalla.oz> - 2019-12-30 17:22 -0600
                Re: What is the data structure of a NULL? David Brown <david.brown@hesbynett.no> - 2019-12-31 13:57 +0100
                Re: What is the data structure of a NULL? Ned Latham <nedlatham@woden.valhalla.oz> - 2019-12-31 07:33 -0600
                Re: What is the data structure of a NULL? David Brown <david.brown@hesbynett.no> - 2019-12-31 15:45 +0100
                Re: What is the data structure of a NULL? Ben Bacarisse <ben.usenet@bsb.me.uk> - 2019-12-30 18:16 +0000
                Re: What is the data structure of a NULL? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2019-12-30 10:45 -0800
                Re: What is the data structure of a NULL? Ned Latham <nedlatham@woden.valhalla.oz> - 2019-12-30 17:29 -0600
                Re: What is the data structure of a NULL? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2019-12-30 21:48 -0800
                Re: What is the data structure of a NULL? Ned Latham <nedlatham@woden.valhalla.oz> - 2019-12-30 04:19 -0600
                Re: What is the data structure of a NULL? David Brown <david.brown@hesbynett.no> - 2019-12-30 17:27 +0100
                Re: What is the data structure of a NULL? Öö Tiib <ootiib@hot.ee> - 2019-12-30 03:25 -0800
                Re: What is the data structure of a NULL? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2019-12-31 21:54 +0000
                Re: What is the data structure of a NULL? James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-12-30 06:03 -0800
                Re: What is the data structure of a NULL? Ned Latham <nedlatham@woden.valhalla.oz> - 2019-12-30 17:01 -0600
                Re: What is the data structure of a NULL? James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-12-30 21:42 -0500
                Re: What is the data structure of a NULL? Ned Latham <nedlatham@woden.valhalla.oz> - 2019-12-31 06:03 -0600
                Re: What is the data structure of a NULL? Öö Tiib <ootiib@hot.ee> - 2019-12-31 06:17 -0800
                Re: What is the data structure of a NULL? Ned Latham <nedlatham@woden.valhalla.oz> - 2019-12-31 10:46 -0600
                Re: What is the data structure of a NULL? Melzzzzz <Melzzzzz@zzzzz.com> - 2019-12-31 16:57 +0000
                Re: What is the data structure of a NULL? David Brown <david.brown@hesbynett.no> - 2019-12-31 18:15 +0100
                Re: What is the data structure of a NULL? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2019-12-31 11:20 -0800
                Re: What is the data structure of a NULL? David Brown <david.brown@hesbynett.no> - 2020-01-01 17:01 +0100
                Re: What is the data structure of a NULL? Ned Latham <nedlatham@woden.valhalla.oz> - 2019-12-31 11:21 -0600
                Re: What is the data structure of a NULL? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2019-12-31 21:37 +0000
                Re: What is the data structure of a NULL? James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-12-31 15:21 -0800
                Re: What is the data structure of a NULL? Chris Vine <chris@cvine--nospam--.freeserve.co.uk> - 2019-12-31 17:26 +0000
                Re: What is the data structure of a NULL? James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-12-31 23:30 -0500
                Re: What is the data structure of a NULL? Manfred <noname@add.invalid> - 2020-01-01 18:10 +0100
                Re: What is the data structure of a NULL? James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-01-01 12:21 -0500
                Re: What is the data structure of a NULL? Chris Vine <chris@cvine--nospam--.freeserve.co.uk> - 2019-12-31 15:20 +0000
                Re: What is the data structure of a NULL? Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2019-12-31 11:11 -0800
                Re: What is the data structure of a NULL? Chris Vine <chris@cvine--nospam--.freeserve.co.uk> - 2019-12-31 19:47 +0000
                Re: What is the data structure of a NULL? James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-12-31 10:27 -0800

csiph-web