Search found 193 matches

by elsairon
May 06, 2011 2:47
Forum: Beginners
Topic: Can FB create arrays of constant values? [YES]
Replies: 2
Views: 642

Your commented code declares an array of const integers, but you try to pass one to get_flag, which takes a non-const integer by reference. This makes it clear. I didn't think of checking how the parameters were passed, which is silly because as I wrote the example I thought, 'why are these both by...
by elsairon
May 06, 2011 0:32
Forum: General
Topic: Can a macro generate enum from list of string variables?[NO]
Replies: 7
Views: 1156

That sounds good. To make my project easier I wanted to be able to easily add and remove additional data/stats to creatures, terrain, items, etc. I chose to use parallel arrays and enums as that was an easy way for me to add multiple additional stats and types of stats without breaking any of the cu...
by elsairon
May 06, 2011 0:08
Forum: Beginners
Topic: Can FB create arrays of constant values? [YES]
Replies: 2
Views: 642

Can FB create arrays of constant values? [YES]

Quick test using a constant array yields error; 'Invalid assignment/conversion'. I'm guessing FB does not support constant arrays? Or am I using const keyword incorrectly? The commented out lines produce errors. ' test flags ' arrays can't be constant? const F01 = 1, F02 = 2, F03 = 4, F04 = 8 const ...
by elsairon
May 05, 2011 23:23
Forum: Beginners
Topic: How does type checking work for enums in FB?
Replies: 15
Views: 1474

Thanks stylin, I will give that a try. I'm using quite a few enum's in my current project and automating the bounds checking for them will really save me a lot of work. (edit) This is tedious as at least one of those enums needs to be changed whenever new enums are added or taken away. As long as th...
by elsairon
May 05, 2011 22:41
Forum: Beginners
Topic: How does type checking work for enums in FB?
Replies: 15
Views: 1474

For my personal use I would like to patch the compiler to do a simple range check on enum values to ensure the value was within range min to max. Example: enum that had values in range from a to z such that; b = a+1 c = b+1 ... z = y+1 (the default enum numbering behavior) Compiler would then only n...
by elsairon
May 05, 2011 11:39
Forum: Beginners
Topic: How does type checking work for enums in FB?
Replies: 15
Views: 1474

I was surprised that range checking was not done. So enum's are not really their own symbol type, they are just an alias for an integer constant, with convenient auto numbering. (so far) Thanks for the replies guys. (edit) My assumption was I could use the enum type to restrict values to the defined...
by elsairon
May 05, 2011 7:22
Forum: Beginners
Topic: How does type checking work for enums in FB?
Replies: 15
Views: 1474

How does type checking work for enums in FB?

Why does this work?

Code: Select all

enum type_check_enum
    a = 0
    b
    c
    d
end enum


dim as type_check_enum test

test = 5

? test
sleep


When code defines a variable as an enum, does it define it as an integer and do no type checking?
by elsairon
May 05, 2011 0:56
Forum: General
Topic: Can a macro generate enum from list of string variables?[NO]
Replies: 7
Views: 1156

Thanks DJ :)

I think I didn't clearly understand the difference in the compile time/ run time divide and that caused my confusion.
by elsairon
May 05, 2011 0:22
Forum: General
Topic: Can a macro generate enum from list of string variables?[NO]
Replies: 7
Views: 1156

Can a macro generate enum from list of string variables?[NO]

Hi All, Short version: Is it possible to use a macro to automatically generate an enum definition based off an array of string names. Explanation: I'm using compiler version 0.21.1 with the following flags: -lang fb -maxerr inf -w all -w next -w param -v -exx I have some data files that are parsed t...
by elsairon
Sep 11, 2010 0:13
Forum: Game Dev
Topic: Anyone remember Moria?
Replies: 79
Views: 20787

Looking forward to this one.
by elsairon
Sep 11, 2010 0:11
Forum: General
Topic: Advice on this code
Replies: 7
Views: 808

Without seeing the code there's not much to be said about it other than wild guessing.

Try tracing the values of your variables by calling a test function in various places and find out exactly where the invalid value(s) occur.
by elsairon
Apr 25, 2009 19:13
Forum: General
Topic: dim shared variables losing values
Replies: 12
Views: 1462

I will try out your exception handler macro on the problem code. I'll post my further questions/results in this thread when I do so.

Thank you MichaelW.
by elsairon
Apr 25, 2009 2:06
Forum: General
Topic: dim shared variables losing values
Replies: 12
Views: 1462

Thanks for the ideas. I should have time to test them out tomorrow and I'll get back with the results. When I include -exx array bounds checking, the program crashes with no error messages. Using -t 1024 and -t 2048 doesn't produce any changes. I do not use these specific variable names in any loops...
by elsairon
Apr 24, 2009 22:35
Forum: General
Topic: dim shared variables losing values
Replies: 12
Views: 1462

After some more testing I have found that changing the order in which the variables are dimensioned changes which variables lose their value. The first two retain their value while the rest are lost. for example dim shared as integer a,b,c,d,e,f causes values a and b to retain their values, while c,...
by elsairon
Apr 24, 2009 20:32
Forum: General
Topic: dim shared variables losing values
Replies: 12
Views: 1462

dim shared variables losing values

I have a strange effect occurring in my project currently which I am so far unable to reproduce in an example. I have set some variable values using dim shared. Some of these values are lost when setting screen mode using the Screen command, depending on which mode I use. In modes 13, 16, and 17 the...

Go to advanced search