-
Interestingly, "print (*a).value1" does not error. I suppose "print *a.value1" should error, though? (and it does)
2009-07-08 02:35:21 UTC in FreeBASIC Compiler
-
Try this. (Whether it is BYVAL or BYREF doesn't matter.)
[code]
declare sub sub1 (byval a as integer)
type b
value1 as uinteger
end type
dim b as b
dim a as b ptr
a = @b
#print typeof((*a).value1) 'Returns UINTEGER
(*a).value1 = 5
'sub1 (*a).value1 'Does not work!
sub1 ((*a).value1)
system
sub sub1 (byval a as integer)
print a
sleep
end sub
[/code]
It seems...
2009-07-04 16:10:44 UTC in FreeBASIC Compiler
-
"PRINT POINT (x, y)" will return an integer, not a uinteger.
2009-06-25 21:19:24 UTC in FreeBASIC Compiler
-
Oh my god, yes!
2009-06-09 05:11:24 UTC in FreeBASIC Compiler
-
I agree with whotookcha0s-_- ...
2009-06-09 05:07:46 UTC in FreeBASIC Compiler
-
Additionally, this feature would not work with recursion. There will be only one instance of mynamespace.var1 created, even if the same sub/function is called twice..
2009-06-09 05:03:15 UTC in FreeBASIC Compiler
-
Basically, I would like a command that is somewhat of a combination of STATIC and SHARED: a way to share variables only between certain functions. This method would be easy to use and allow the used variables easily removed or changed, unlike the only current methods available of either using globals or putting all the relevant functions inside a giant UDT.
Syntax:
For each function or sub...
2009-06-09 05:00:54 UTC in FreeBASIC Compiler
-
'warning 10(0): UDT with pointer or var-len string fields, at parameter 3
type testAType
dim as integer a=5 '
2008-10-30 20:48:18 UTC in FreeBASIC Compiler
-
Ok, I see now that in the first case the local scope is what is preventing the error, but why would it error before branching?.
2008-10-03 06:05:04 UTC in FreeBASIC Compiler
-
Why does the first case allow the code to go through, but not the second? Also, why does the compiler think I have a duplicated definition in only the second case?
if 1 then
dim as integer a=1
else
dim as integer a=2
end if
if 1 then
goto r1a
r1b:
else
goto r2a
r2b:
end if
sleep
system
r1a: dim as integer c=1: goto r1b
r2a: dim as integer c=2: goto r2b.
2008-10-03 05:56:58 UTC in FreeBASIC Compiler