![]() |
Chat on IRC |
Bad Habits? ? ? ? !! ?? !! ??
Posted by andymcnab [send private reply] at September 24, 2002, 07:06:15 AM
Umm... I have just started programming with Visual C++ from Visual Basic. And i want to know what in VB gives you bad programming habits like you all say. So far i have found no disadvantage of starting with Visual Basic.
Posted by DragonWolf [send private reply] at September 24, 2002, 09:56:04 AM
Visual Basic doesn't let you easily do things that are bad programming practice.
Posted by Neumann [send private reply] at September 24, 2002, 10:13:22 AM
Old Basics like GWBasic taught bad programming practice because of the heavy use of GOTOs and line numbers which made programs cryptic and hard to read.
Posted by DragonWolf [send private reply] at September 24, 2002, 10:30:30 AM
ya .net is good in that respect. Its what I really hated about the old VBs
Posted by CodeRed [send private reply] at September 24, 2002, 10:31:38 AM
Everyone badmouths goto's but guess what? Whether you use them or not you are still using them. Assembly language relies heavely on goto's, they are not evil when used properly, you're all just narrow minded.
Posted by Neumann [send private reply] at September 24, 2002, 10:36:10 AM
Oh well of course we are narrow minded because we DIDN'T THINK that somebody would come out and say assembly language was full of GOTO.
Posted by DragonWolf [send private reply] at September 24, 2002, 10:38:25 AM
The idea is that a program is well structured therefore it is easier to read and understand.
Posted by CViper [send private reply] at September 24, 2002, 12:06:04 PM
Functions are actually called by "special" goto's; instead of just jmp'ing to a specific location, you store the current position of execution (eip or whatever) on the stack before jmp'ing there. When leaving a function through 'ret', it pops of that position from the stack ... and jmp's there.
Posted by RedX [send private reply] at September 24, 2002, 12:23:18 PM
Amen!
Posted by CodeRed [send private reply] at September 24, 2002, 03:28:07 PM
I posted an example of a situation where using goto's made the code more readable and better structured than the equivalent looping implementation. I'll try to find it. And assembly does use gotos whether you like it or not, they just arent called that. You label a line, then you call that line label, same thing.
Posted by Neumann [send private reply] at September 24, 2002, 03:40:48 PM
This is pointless...
Posted by RedX [send private reply] at September 24, 2002, 03:54:25 PM
Goto is nothing but a tool. (just like a chainsaw) Use it wisely and it can provide great power (like a chainsaw). Use it foolish and suffer greatly (do I need to say more?)
Register as a new user | ||||||||||||||