Search found 10 matches

by tick_da
May 19, 2015 15:10
Forum: Beginners
Topic: Can I change default initial values?
Replies: 12
Views: 1281

Re: Can I change default initial values?

vdecampo wrote:You want a variable that can only be assigned once. Correct?


No, I want that all variables be assigned at least once (not including auto-assignment of zero value or empty string by the compiler itself).
by tick_da
May 18, 2015 18:35
Forum: Beginners
Topic: Can I change default initial values?
Replies: 12
Views: 1281

Re: Can I change default initial values?

issue a warning if a variable gets assigned a constant value more than once? Actually "less than once" (or "less than twice" if we also count assignments made by the compiler itself) is a better description. But I don't care if this value is constant or not. Using INPUT as a sou...
by tick_da
May 18, 2015 14:14
Forum: Beginners
Topic: Can I change default initial values?
Replies: 12
Views: 1281

Re: Can I change default initial values?

you could write a code manipulator which scans the source code for DIM-statements The feature is supposed to be used in '-lang qb' mode. Some variables will have no DIM-statements. to establish a normally not accessible value Of cause I don't want to touch any non-accessible values. To be useful th...
by tick_da
May 15, 2015 16:15
Forum: Beginners
Topic: Can I change default initial values?
Replies: 12
Views: 1281

Re: Can I change default initial values?

vdecampo, I am talking about default initial values not about optional initial values. I want to have ability to change these defaults to something else (to make sure I did not forget to initialize a variable). Trying to change optional initial values for testing purposes is too hard and error prone...
by tick_da
May 15, 2015 14:28
Forum: Beginners
Topic: Can I change default initial values?
Replies: 12
Views: 1281

Can I change default initial values?

Sometimes I forget to initialize a variable. And it is not always possible to find such bug by testing. Sometimes the bug can be noticed only when I copy that code to a different context. That's because in a specific context the default initial values (zero for integers and empty string for strings)...
by tick_da
May 13, 2015 18:44
Forum: Beginners
Topic: FreeBASIC variable initialization
Replies: 14
Views: 3667

Re: FreeBASIC variable initialization

vdecampo, thank you. I tried FreeBASIC only for a couple of days. That's why I still didn't learn all command line arguments that I need. I was wrong when I thought that FreeBASIC cannot check array bounds. But still '-exx' is not only a compile-time check it is also a run-time check. So my opinion ...
by tick_da
May 13, 2015 15:11
Forum: Beginners
Topic: FreeBASIC variable initialization
Replies: 14
Views: 3667

Re: FreeBASIC variable initialization

RockTheSchock, my question was about '-lang qb' mode, not about '-lang fb' mode or '-lang fblite' mode. Anyone who wants to declare all scalar variables can use '-lang qb' mode. But I don't want mandatory variable declaration because it does almost nothing to prevent me from simple mistakes. For exa...
by tick_da
May 12, 2015 17:29
Forum: Beginners
Topic: FreeBASIC variable initialization
Replies: 14
Views: 3667

Re: FreeBASIC variable initialization

RockTheSchock, I didn't know about the VAR keyword. Now I have tried it. This is almost what I want. But the VAR keyword is redundant. Why do I have to type four additional characters 'var '? As I said earlier in simple cases the compiler can figure out the type without DIM or VAR. After all if I as...
by tick_da
May 12, 2015 12:09
Forum: Beginners
Topic: FreeBASIC variable initialization
Replies: 14
Views: 3667

Re: FreeBASIC variable initialization

fxm, I am aware that FreeBASIC in FB mode has mandatory and explicit variable declaration. But I think that this feature is much worse way of protecting me from mistyping a variable name because it does not protect me from forgetting to initialize a variable. And I have to initialize all variables a...
by tick_da
May 11, 2015 16:46
Forum: Beginners
Topic: FreeBASIC variable initialization
Replies: 14
Views: 3667

FreeBASIC variable initialization

Hello. I tried FreeBASIC and I like it. But one feature is missing. I want FreeBASIC to require from a programmer to always initialize all variables before first usage. The code like this PRINT A or B = B + 1 should be illegal but the code like A = 0 PRINT A or B = 0 B = B + 1 or INPUT B B = B + 1 s...

Go to advanced search