@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13



Comments:

<0> Antrix, don't let anyone know i told you, but internally really a reference and a pointer are the same thing they just have different syntax
<1> Who knows
<2> "Looks like a pointer (or something else) that hasn't been initialized"
<1> Maybe it points to a map that has an URL and it checks the URL to knows what the value is
<3> so the resulting asm would be equalent if you use a constant pointer and reference ?
<0> ...and in the real world it implemented using a pointer on the machine code level...
<0> Antrix, yes, correct.. for every compilre in existance on every machine that I have ever heard of, yes
<3> coolio
<0> a reference is just a more "safe" sort of pointer to use.. it is a language feature .. but you could get away without ever using it and just using pointers.. pointers are just slightly less safe because the compiler has less information about hwo you will be using them, since they are more general than a reference
<3> mm :)
<4> MmmCake: asm != c++, what if you have a c++ interpreter, not a compiler? and everything is parsed without being coverted?
<3> man.. staying in here for a week is going to turn me into some kinda monkey genious
<0> sk8, ok forget about the implementation.. i could prove to you formally why a pointer isi a more general form of a reference
<1> If you just listen to MmmCake it'll be more monkey than genious
<3> LOL
<0> Antrix, pay them no mind, they are just less experienced than me and haven't yet made the connections i have in their puny brains



<3> i'm not taking any sides here
<0> lol
<4> MmmCake: a reference, theoreticaly is another name for the same object
<4> while a pointer, points to an object
<3> u mean like an alias
<4> do you see the difference?
<0> in fact, anywhere but in this channel a pointer is defined as a more simple and general form of the reference data type
<4> yeah
<4> like an alias
<0> pick up a programming language textbook and look up pointer
<0> it is defined in terms of a reference
<4> ...
<1> First wikipedia paragraph
<1> A pointer is a simple implementation of the general reference datatype (although it is quite different from the facility referred to as a reference in C++).
<0> in fact go to wikipedia and look up pointer
<1> See, I can even read your mind
<0> it is not quite different
<1> Your connections went to the wrong server
<0> that is wrong
<3> MrAshe have you coded a mindreading cl*** hierarchy ?
<0> ok go to reference.. click ont hat link
<4> is not wrong, that's how it is, you care too much about the implementation
<0> In the C++ programming language, a reference is a simple reference datatype that is less powerful but safer than the pointer type inherited from C, which is a reference in the general sense but not in the sense used by C++.
<0> no, i do not care too much about the implementation
<0> i think the artificial delineation used when taeching c++ between pointer and reference hurts students rather than helps them
<1> "C++ references differ from pointers in several essential ways"
<1> From your very same page
<0> yes, they do
<0> i never said they are the same thing
<0> one is a more general form of another
<1> Yet it's not
<4> no
<4> a pointer is not a generalisation
<4> of a reference
<3> its cos students are to busy drinking beer and hunting for willing women
<3> :/
<1> This equivalence is a reflection of the typical implementation, which effectively compiles references into pointers which are implicitly dereferenced at each use
<1> "typical implementation"
<4> ok... here's my final statement
<4> char * p = NULL;
<1> Gotta love teach "more experienced" people
<0> you aren't taeching me anything
<0> yes, i know char & p = someotherchar. i know.
<4> MmmCake: a pointer can point anywhere
<0> p can never be null, i know
<0> yes i know
<0> a reference is just a safe pointer that's all
<0> actually a reference can point anywhere.. how to you explain this one:
<1> When you p*** by reference and by pointer, it's just the same too, right?
<0> chat & p = *(char *)(0);
<1> Just the pointer is more general
<1> And he even uses C casts, must be so highly experienced heheh
<0> no, the syntax differs but the concept is that they are related
<1> And of course you know the line you typed is undefined behavior, as everybody knows
<4> in the implementation they are!
<0> yes
<1> I'm not talking about the syntax
<0> it is undefined behavior, but i just proved to you that a reference is a pointer
<3> *(char *)(0) ... how is this a reference ?? :S



<1> And you didn't prove it was a pointer, since it's undefined behavior, it could very well make your computer explode
<5> can you have a member variable that is a reference?
<1> Sure
<5> I guess it must be initialized in the constructor then
<1> Yup
<5> ok
<3> you cast 0 as a char pointer.. then dereference ? how will that give u a char REFERENCE ? i dont get it please explain
<1> Btw p***ing by reference and pointer is not just syntactically different, just so you know
<0> anyway this wiki page says it: "a reference is a simple reference datatype that is less powerful but safer than the pointer type inherited from C"
<1> Antrix: if your compiler treats references as pointers (internally), then it'll work fine as long as you don't use the reference
<3> i see
<0> (because every compiler ever made treats references as pointers, as everyone knows..)
<1> As long as the standard doesn't say it should, who cares
<1> Are you the one people call a lawyer?
<4> MmmCake: that's not the point
<1> Oh wait, you didn't know why
<1> Sorry
<3> if you try to use the reference... you'll be accessing random memory somewhere?
<1> No, you'll access memory at 0
<1> Or try to, anyway
<3> mm
<4> MmmCake: by the way, in your example
<4> you're dereferencing the pointer
<0> Antrix: just remember that a reference is a pointer that doesn't need a * to dereference or doesnt' need an & when initializing, and you will never be confused again.. don't let these c++ dudes confuse you otherwise
<4> no
<0> sk8, true, that's why it's undefined
<0> touche
<4> that's why you don't have a point
<0> i do have a point
<0> you just don't get it
<0> because yuo lack the mental plasticity
<3> nah im not really confused about this any more... i'm ok :)
<0> it's ok, i'm used to it
<0> cant' expect everyone to be as wonderfully enlightened as me
<4> MmmCake: stop insulting me, it's not helping anyone
<1> It's undefined because it can only be obtained by dereferencing a null pointer
<1> Not because it is internally represented as a pointer with a value of 0
<4> MmmCake: c++ is c++ a reference is different than a pointer
<4> diffrent data types
<4> .
<0> i never said they are the same thing
<4> asm has nothing to do with it
<0> i said you can think of one as a more restricted form of the other one
<4> and how it's interpreted
<4> you can't
<0> i know that, but in a language sense, one is a more restricted form of another
<4> because they are different!
<0> anyway i am tired of this
<1> You didn't say that, you said "both are references"
<0> ok fine i did say that
<0> but i refined my argument to clarify
<0> in a language sense both ARE references
<1> Yet they work in a completely different way
<1> And are p***ed differently
<0> if by completely you mean "pretty much the same"
<0> then i agree
<1> Not like you ever answered to the p***ing by reference/pointer difference
<0> i am not sure i understood your question
<1> That's the point, you didn't, because you don't know
<1> Pointers are p***ed by value
<0> ok suppose i told you to write a p***-by-reference function without using reference data types.. how would you do it?
<1> I wouldn't, because only references work that way
<0> ok let me state this more unambiguously: suppose i told you to write a function that can be called on objects of type T that modifies T and you can't use a C++ reference (T &).. how would you write it?
<0> in languages that lack call by reference (C for example) you use pointers to affect the same behaviour
<1> Doesn't have anything to do with p***ing by reference or value
<0> yes it does
<0> if you don't see why it does then i am sorry
<0> it's your loss
<4> MmmCake: a reference is a different concept, get used to it
<0> not really.. get used to it
<1> register is the same as nothing, cause most compilers ignore it, woot
<1> Gotta love thinking only about the implementation
<1> Most of the time const is the same as nothing too, in fact


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #c++
or
Go to some related logs:

#linuxhelp
narf skokie
#linux
geodesic sphere^code
decetel
#chatzone
#MissKitten
the infamous contraction of Geheime Staatspolizei
#mirc
#linux



Home  |  disclaimer  |  contact  |  submit quotes