Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
define argument types in subs
#21
I think it's still strange. Like yesterday, I had it again. I always type '$DYNAMIC and DEFINT A-Z at the beginning of a program, it's the first thing I do. But then, when making a sub, poof, the IDE put DEFSNG A-Z on top of it Smile
Reply
#22
Wierd QB ghosts playing mischief =P
Reply
#23
Quote:I think it's strange. Every QB45 version I've tried does it sometimes. :-?

It happens when you don't especify the numeric variable type (AS bleh or using the sufixes) in the arguments of a SUB or FUNCTION and you call it with a SINGLE parameter (or a variable which hasn't been declared as anything different of SINGLE).
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#24
Its none of those cases. I always use a suffix or AS foo to define my variables =).
Reply
#25
After two years of exclusive coding in Visual Basic 6, I've found that I've used AS in all variable declarations in QB in all my recent coding. Just better coding practice, I assume. Smile I wish QB had an "OPTION EXPLICIT" like VB does...
I'd knock on wood, but my desk is particle board.
Reply
#26
I prefer the use of suffixes just for the simple reason that I can tell which type is each variable without having to look in the declarations section.

TBBQ: Well, then I have no clue :lol:
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#27
yeah me too. Its easier for anyone to recognize the variable type by looking at its suffix =).
Reply
#28
I guess whatever practice works for people is best Big Grin

For me, whenever I create a variable, I already know what its type is and I don't have to refer to its declaration. With older code, if I've forgotten what type it is, I look at how I used it. I also rarely use SINGLEs or DOUBLEs, and LONGs are only used for things I know I'll need the space for. In VB, I use BYTEs whenever I need very small values, plus in VB, you can just right-click and get Quick Info on the variable to get its type if you don't know what it is. Of course, you can also hit F1 with the cursor on the variable in the QB IDE for a similar effect. Smile
I'd knock on wood, but my desk is particle board.
Reply
#29
Quote:[...] you can also hit F1 with the cursor on the variable in the QB IDE for a similar effect. Smile

Very true, but I learned that only a couple of months ago Tongue Now I am used to the good ol' suffixes Wink
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#30
It doesnt matter whatever convention you use. But if you use suffixes then your code becomes more readable to others.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)