DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: c++ resources for the VB programmer  (Read 12,404 times)

Booma-Booma

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 45
c++ resources for the VB programmer
« on: February 04, 2007, 02:45 PM »
Hi all,
I was wondering if any of you could point me to some specific resources about c++ geared towards a VB programmer?

For example, in VB this works as expected:

if x = 6 then....

However in c++:
If (x=6) ....

Doesn't work as I would have expected (coming from a VB background). It took me some time to figure it out. It actually assigns the value of 6 to x. I won't make that mistake again!

In c++ if you declare a variable:

int x;

and then do something like this:
x++;
cout << x;

I get some weird number. I figured that x is being initialized to some random number. Is there any way to have int default initial value = 0?

I am using Dev-c++ for an ide and was wondering how can I set break points so that I can trace through and inspect variable values? I guess what I am getting at is, is there a facility to run programs similar to the way VB does? Or should I just change my mind set?

Cheers,
Troy

Eóin

  • O'Callaghan
  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 1,401
Re: c++ resources for the VB programmer
« Reply #1 on: February 04, 2007, 03:02 PM »
I would almost suggest getting a beginners book to C++ and forgetting about what you've learned from VB initially. Once you get past learning the syntax then all your VB knowledge will really stand to you, but initially it could be just confusing because of the subtle differences like those two you've pointed out.
Interviewer: Is there anything you don't like?
Bjarne Stroustrup: Marketing hype as a substitute for technical argument. Thoughtless adherence to dogma. Pride in ignorance.

Booma-Booma

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 45
Re: c++ resources for the VB programmer
« Reply #2 on: February 04, 2007, 04:15 PM »
I would almost suggest getting a beginners book to C++ and forgetting about what you've learned from VB initially. Once you get past learning the syntax then all your VB knowledge will really stand to you, but initially it could be just confusing because of the subtle differences like those two you've pointed out.

Eóin, you make a good point! I do have a beginners book on c++ and am reading it. I was just wondering if anybody had heard of specific resources that would help a VB program unlearn bad habits  ;). For the last year or so I was getting into the .net thing. But I am realizing there are far more resources out there for c++ then VB. The other thing that I really like is the potential for cross-platform programing, that would be awesome!

Cheers,
Troy

Eóin

  • O'Callaghan
  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 1,401
Re: c++ resources for the VB programmer
« Reply #3 on: February 04, 2007, 05:06 PM »
If you're coming from VB.net then C# could be a wiser option. It's still got the whole ".net thing" but also it is proving to be quite popular so there'd be a lot of resources out there.

That said I'm a C++ programmer myself, and really love the language so I am certainly not discouraging you away from it, but there is no harm in looking into other options :) .
Interviewer: Is there anything you don't like?
Bjarne Stroustrup: Marketing hype as a substitute for technical argument. Thoughtless adherence to dogma. Pride in ignorance.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,931
    • Gathering Badge
    • Plugin Coding Medal
    • Participated in NANY Challenge Seventeen Times
    • Cody Award
    • Coding Snacks
    • Volunteers/Staff
Re: c++ resources for the VB programmer
« Reply #4 on: February 04, 2007, 05:27 PM »
I agree with Eoin, not only might c# be a better match, but it's a more modern and "pure" language that will likely teach you better habits  (ironically this advice is again coming from a c++ coder).

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,931
    • Gathering Badge
    • Plugin Coding Medal
    • Participated in NANY Challenge Seventeen Times
    • Cody Award
    • Coding Snacks
    • Volunteers/Staff
Re: c++ resources for the VB programmer
« Reply #5 on: February 04, 2007, 05:29 PM »
back to your questions thought:

You can set breakpoints and debug in dev-c++, though its not the best debugging environment.  You could also get Microsoft's free c++ edition.

You've now encountered 2 of the many c++ pitfalls, and survived them, so you are on the right track.
You can initialize variables in c++ when you declare them:
Code
int x=0;

Actually understanding why int variables are not initialized will tell you a bit about the mindset of c++ coders and compiler designers.  C and C++ are designed for speed - so unless you specifically tell the program to set the variable, it's not going to waste precious cpu cycles doing it for you.
« Last Edit: February 04, 2007, 05:32 PM by mouser »

tinjaw

  • I'm so glad breakbeat techno isn't an illegal drug
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,927
    • Participated in NANY Challenge Twice
    • Coding Snacks
    • Military Service Badge - US Army
    • Linux User
Re: c++ resources for the VB programmer
« Reply #6 on: February 04, 2007, 06:54 PM »
Python Rocks! [attach=#1]

I'm going to jump in and ask you why you are learning C++? Each language has its own advantages and disadvantages. And depending on what you are coding, some languages may be better suited to the task than others. So, why C++?

Gothi[c]

  • DC Server Admin
  • Charter Honorary Member
  • Joined in 2006
  • ***
  • Posts: 873
    • Gathering Badge
    • Coding Snacks
Re: c++ resources for the VB programmer
« Reply #7 on: February 04, 2007, 07:02 PM »
Maybe because C++ compiles to real binary code instead of running on an interpreter or a vm like python, java, perl, .net, etc,.. etc,... :P

Booma-Booma

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 45
Re: c++ resources for the VB programmer
« Reply #8 on: February 04, 2007, 07:41 PM »
I have looked at c# - It is OK, but I would rather invest my time in learning a language that I can compile to native code and potentially target different operating systems other than windows (I am a big fan of NetBSD). With that said, I can't justify switching from vb.net to a language like c# because it is more popular. From everything that I have read and tried, I can do pretty much everything in vb.net that I could do in c#. So switching doesn't make sense to me.

I have a couple of specific goals in learning c++:
1) I'd like to be able to create dll libraries that I can use from VB6 and .net (etc.) for the times that the engineering calculations are not fast enough in VB6. I have written up some pretty complex Finite Element Analysis models using VB. It worked well but some times it could take a few hours to run through the calculations. I would like to be able to (or at least have the potential) reduce the time it takes.

2)I'd like to be able to access the vast numerical libraries available to c++. 

3)I'd like to create programs that don't need to be registered or require a virtual machine to run.

4)I want to learn something that is worth while learning and will be around for many, many more years.


Eóin

  • O'Callaghan
  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 1,401
Re: c++ resources for the VB programmer
« Reply #9 on: February 04, 2007, 07:55 PM »
Well 2) and 3) would really clinch it for me too, C++ sounds like the way to go. Good luck, it's a fun language :Thmbsup:
Interviewer: Is there anything you don't like?
Bjarne Stroustrup: Marketing hype as a substitute for technical argument. Thoughtless adherence to dogma. Pride in ignorance.

Booma-Booma

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 45
Re: c++ resources for the VB programmer
« Reply #10 on: February 04, 2007, 07:58 PM »
Well 2) and 3) would really clinch it for me too, C++ sounds like the way to go. Good luck, it's a fun language :Thmbsup:

I've been drooling over numerical recipes in c++ for awhile now!

tinjaw

  • I'm so glad breakbeat techno isn't an illegal drug
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,927
    • Participated in NANY Challenge Twice
    • Coding Snacks
    • Military Service Badge - US Army
    • Linux User
Re: c++ resources for the VB programmer
« Reply #11 on: February 04, 2007, 08:26 PM »
Booma-Booma,

Those are good reasons. Good luck with your studies. It sounds like you are on the right track.

Ruffnekk

  • Uhm yeah...
  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 332
    • Programming School - Stage 1 Medal
    • Programming School - Deluxe Bonus Medal
    • Participated in NANY Challenge Once
    • Linux User
Re: c++ resources for the VB programmer
« Reply #12 on: February 09, 2007, 07:26 AM »
It has been said before already, but I want to stress it again: forget everything you know about VB if you want to go to C++. The languages are so different that it's best (and almost a requirement) to start from the absolute beginning. On the other hand, Java could be an option. The syntax will be easier for you and you can also create cross-platform applications.
Regards,
RuffNekk

Programming is an art form that fights back.

Original address: https://www.donationcoder.com/forum/index.php?topic=7326.0