May 27, 2005 Re: Bjarne Stroustrup takes issue with the 'null' keyword | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sam | >Pointers are numbers! Well, text is represented as numbers as well. But it's stupid to think about text as numbers. Instead you should simply read it as text. So you should think about pointers as something that stores positions of objects not as numbers. >0x00000000 is the null pointer in C++, that's why we can use 0 instead of null. And Bjarne has stated that this hasn't changed on any machine that he knows of, and probably won't ever change. > >If I have a pointer p (in C++) to an array of 3 ints, and p = 0xffffff20, then to access the second item in the array I can do: > >int i = *(p + 1) // 0xffffff21 > >So if you can do arithmetic on pointers they must be numbers! Right? Wrong. pointer + pointer => error If you can't even add them you can't say they are numbers (ever seen a number that can't be added to another one? There are even languages that allow things like string * number to repeat a string several times. So are strings numbers? I don't think so. |
May 27, 2005 Re: Bjarne Stroustrup takes issue with the 'null' keyword | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ben Hinkle | In article <d75oct$chc$1@digitaldaemon.com>, Ben Hinkle says... > > >"Sam" <Sam_member@pathlink.com> wrote in message news:d75g34$6eb$1@digitaldaemon.com... >> >> Should I use NULL or 0? >> >> To quote Bjarne Stroustrup, the god of C++: > >http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1488.pdf or http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1601.pdf |
May 27, 2005 Re: Bjarne Stroustrup takes issue with the 'null' keyword | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sam |
With all due respect sir, as a programmer with more than 13 years of working experience (10 in C/C++ fields), I must say that your "Bjarne-god story" is not for this newsgroup (i do not want to use some "bad words" actually)...
Think about D as a mix of all goods from all modern languages, and some
original ideas.
Depending on level of type-safety You want NULL can be treated differently.
I personally like D's approach.
--
...........
Dejan Lekic
http://dejan.lekic.org
|
May 27, 2005 Re: Bjarne Stroustrup takes issue with the 'null' keyword | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jarrett Billingsley | In article <d75rh5$fg2$1@digitaldaemon.com>, kb3ctd2@yahoo.com says... > "Sam" <Sam_member@pathlink.com> wrote in message > news:d75g34$6eb$1@digitaldaemon.com... > You know what I can't stand? That pesky "if" keyword. Why can't we just > use the ?: operator everywhere? The fewer keywords, the easier, right? :P Those who do not know Lisp are condemned to repeat it. :) ( in lisp the 'if' function is 'ternary' (and many other functional languages ( can be used in conjuction with map and reduce ( 'jus sayin' is all ) ) ) ) - Factory |
May 27, 2005 Re: Bjarne Stroustrup takes issue with the 'null' keyword | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | Not if DMD doesnt build decent debug info it wont. Im very dissappointed that you still cant view members & globals whilst debugging executables. At least C++ has excellent debugging support. In article <d75uqd$i6n$1@digitaldaemon.com>, Walter says... > > >"Sean Kelly" <sean@f4.ca> wrote in message news:d75jdf$930$1@digitaldaemon.com... >> If that isn't enough, Bjarne Stroustrup and Herb Sutter proposed a >language >> extension for the next iteration of the C++ standard: the addition of a 'nullptr' constant (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1488.pdf). In >short, >> I think there's ample support for the existence of 'null' in D :) > >Some day, C++ will catch up with D <g>. > > |
May 28, 2005 Re: Bjarne Stroustrup takes issue with the 'null' keyword | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | "Walter" <newshound@digitalmars.com> wrote in message news:d75uqd$i6n$1@digitaldaemon.com... > > "Sean Kelly" <sean@f4.ca> wrote in message news:d75jdf$930$1@digitaldaemon.com... >> If that isn't enough, Bjarne Stroustrup and Herb Sutter proposed a > language >> extension for the next iteration of the C++ standard: the addition of a 'nullptr' constant (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1488.pdf). In > short, >> I think there's ample support for the existence of 'null' in D :) > > Some day, C++ will catch up with D <g>. It already did, several years ago: #include <stlsoft_nulldef.h> |
Copyright © 1999-2021 by the D Language Foundation