Posts: 1,845
Threads: 44
Joined: Aug 2002
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
Posts: 4,307
Threads: 63
Joined: May 2003
Wierd QB ghosts playing mischief =P
Posts: 6,419
Threads: 74
Joined: Mar 2002
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).
Posts: 4,307
Threads: 63
Joined: May 2003
Its none of those cases. I always use a suffix or AS foo to define my variables =).
Posts: 3,279
Threads: 170
Joined: Nov 2003
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.
I wish QB had an "OPTION EXPLICIT" like VB does...
I'd knock on wood, but my desk is particle board.
Posts: 6,419
Threads: 74
Joined: Mar 2002
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:
Posts: 4,307
Threads: 63
Joined: May 2003
yeah me too. Its easier for anyone to recognize the variable type by looking at its suffix =).
Posts: 3,279
Threads: 170
Joined: Nov 2003
I guess whatever practice works for people is best
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.
I'd knock on wood, but my desk is particle board.
Posts: 6,419
Threads: 74
Joined: Mar 2002
Quote:[...] you can also hit F1 with the cursor on the variable in the QB IDE for a similar effect.
Very true, but I learned that only a couple of months ago
Now I am used to the good ol' suffixes
Posts: 4,307
Threads: 63
Joined: May 2003
It doesnt matter whatever convention you use. But if you use suffixes then your code becomes more readable to others.