• Welcome to Valhalla Legends Archive.
 

VB vs. C++

Started by MoNksBaNe_Agahnim, November 14, 2003, 06:16 PM

Previous topic - Next topic

Skywing

Quote from: CupHead on November 26, 2003, 06:11 PM
Myndfyre, what are you talking about?


Dim x as String
Dim y as Long

y = StrPtr(x)


y is now the pointer to x, x has the contents of y.  It's like y = &x in C++.

Mitosis: I think you've confused your compilers.
Can you then do things like modify the contents of x through y like you can in C++, without having to resort to unwieldy calls to exported memcpy functions?

CupHead

Not really, you have to use CopyMemory calls if you want to modify it.   I think the best information regarding these pointers is here: http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/q199/8/24.asp&NoWebContent=1

Arta

#17

Skywing

Quote from: CupHead on November 26, 2003, 06:33 PM
Not really, you have to use CopyMemory calls if you want to modify it.   I think the best information regarding these pointers is here: http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/q199/8/24.asp&NoWebContent=1
Then VB doesn't have true pointers as part of the language itself.  Using a kludge with dll exports written in some other language doesn't make it a VB language feature.

CupHead

Quote from: Skywing on November 26, 2003, 06:41 PM
Then VB doesn't have true pointers as part of the language itself.  Using a kludge with dll exports written in some other language doesn't make it a VB language feature.

Um...  So nothing done in VB is a VB language feature because VB wasn't written in VB?

Quote from: Arta[vL] on November 26, 2003, 06:41 PM
QED. VB < C/C++.

Jesus Christ, what is it with you people?  I wasn't arguing that VB is better, just that most people don't know about these similar features and that VB isn't all that bad.

Skywing

#20
Quote from: CupHead on November 26, 2003, 06:59 PM
Quote from: Skywing on November 26, 2003, 06:41 PM
Then VB doesn't have true pointers as part of the language itself.  Using a kludge with dll exports written in some other language doesn't make it a VB language feature.

Um...  So nothing done in VB is a VB language feature because VB wasn't written in VB?
No.  A "language feature" is something that is intrinsically provided by (or is integrated with) the compiler/interpreter/etc.  If you have to explicitly callout to code written in some other language, it's not a language feature.

CupHead

Even though everything in VB is a call to something written in a different language, if it's in the VB runtime, then it's a language feature because it's provided already?  I think that's what you're saying?

j0k3r

Yeah Mitosis, VB will highlight the line and IIRC will tell you the error.
QuoteAnyone attempting to generate random numbers by deterministic means is, of course, living in a state of sin
John Vo

Banana fanna fo fanna

Quote from: CupHead on November 26, 2003, 07:27 PM
Even though everything in VB is a call to something written in a different language, if it's in the VB runtime, then it's a language feature because it's provided already?  I think that's what you're saying?

A pointer is not simply an integer (or long) containing the memory address of a variable. It is a vehicle that you can use to pass-by-reference, automatically look up the contents of memory at a certain address, and change that memory, all while using a single operator.

CupHead

A pointer is simply an unsigned long containing the memory address of a variable.  That's it, nothing more.  How and what functions a compiler is able to apply to that pointer have nothing to do with the fact that the object is a pointer.  The dereference operator is not a pointer.  It cannot be called a pointer.  The address-of operator is not a pointer either.  Passing by reference is not a pointer.  This "vehicle" you speak of is called a programming language, not a pointer.

MyndFyre

Quote from: Skywing on November 26, 2003, 06:41 PM
Quote from: CupHead on November 26, 2003, 06:33 PM
Not really, you have to use CopyMemory calls if you want to modify it.   I think the best information regarding these pointers is here: http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/q199/8/24.asp&NoWebContent=1
Then VB doesn't have true pointers as part of the language itself.  Using a kludge with dll exports written in some other language doesn't make it a VB language feature.

This ^^ is exactly what I was talking about.

Pointer usage is NOT a language feature of VB as it is in C/++.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

CupHead

Quote from: Myndfyre on November 26, 2003, 05:33 PM
However, with VB, IIRC, you don't actually use pointers - that is, there's no way to access the contents to which they point.  You can marshal your data to point to strings or objects because other languages (enabled with COM) require this; however, aside maybe from function callbacks, you don't actually use pointers.

Actually, what you said was that you can't access the contents of a pointer, which is incorrect, because you can access the contents through the original variable.  If you were talking about something else, you should have said so.

Mitosis

Quote from: j0k3r on November 26, 2003, 07:52 PM
Yeah Mitosis, VB will highlight the line and IIRC will tell you the error.

Well then my compiler is screwed up then, when ever there is an error it does nothing.

j0k3r

I think you need to enable the error display in options somewhere (I'm speaking from VB6 I think... don't remember all too well). I remember having to enable something when I took the classes.
QuoteAnyone attempting to generate random numbers by deterministic means is, of course, living in a state of sin
John Vo

Banana fanna fo fanna

Quote from: CupHead on November 26, 2003, 08:30 PM
A pointer is simply an unsigned long containing the memory address of a variable.  That's it, nothing more.  How and what functions a compiler is able to apply to that pointer have nothing to do with the fact that the object is a pointer.  The dereference operator is not a pointer.  It cannot be called a pointer.  The address-of operator is not a pointer either.  Passing by reference is not a pointer.  This "vehicle" you speak of is called a programming language, not a pointer.

No, it isn't. It's a syntax construct.

|