#cmdline "-RR"
declare function rand cdecl alias "rand" () as long
declare sub srand cdecl alias "srand" (byval as ulong)
Function rndX(s1 As String) As String
#macro GetNumber
#define range(f,l) (rand mod ((l-f)+1)) + f
s[0]=range(48,s1[0])
For n As Long = 1 To L-1
s[n]=range(48,57)
Next
#endmacro
#macro compare(n1,n2,ans)
Var lenn1=Cast(Integer Ptr,@n1)[1],lenn2=Cast(Integer Ptr,@n2)[1]
If lenn1 > lenn2 Then ans=-1:Goto lbl
If lenn1 < lenn2 Then ans=0:Goto lbl
If n1 > n2 Then ans = -1 Else ans= 0
lbl:
#endmacro
Dim As Long L=Cast(Integer Ptr,@s1)[1],ans=1
Dim As String s=String(L,0)
While ans
GetNumber
compare(s,s1,ans)
Wend
Return iif(s<>"0",Ltrim(s,"0"),"0")
End Function
srand(timer)
print "Biggish random number:"
print rndx("9"+string(2000,"9"))
var file= rtrim(command(0),".exe")+".asm"
shell "notepad "+file
kill file
sleep
Anybody:
Is there a bug in 32 bits Win 10? The #cmdline "-RR" seems to do nothing.
type tudt
aaa as INTEGER
bbb as INTEGER
End Type
dim as tudt udt
dim as any ptr ptrbuffer
dim as uinteger tempvar
asm nop '''added for an easy search
TempVar = *Cast(Uinteger Ptr, ptrBuffer)
asm nop
Here, 64 bit fbc creates the .asm file and shows it via notepad.
32 bit fbc doesn't create the asm file, so notepad cannot show it, but throws up a cannot find the file error.
If I use -RR as an ide setting or bare command line flag then no problems.
I cannot use RdRand because my computer is 2011, so my example is a different random function (bottom up instead of top down).
But of course any bit of source which compiles would do.
So my query is why doesn't #cmdline "-RR" not work in 32 bits, or does it work with others here?
Win 10, official builds and SARG's _latest.exe builds.
dodicat wrote: ↑Mar 11, 2023 19:52
Anybody:
Is there a bug in 32 bits Win 10? The #cmdline "-RR" seems to do nothing.
Looks like a bug. In the case of gas backends: because neither '-R' nor '-RR' is on the real command line, the '.ASM' file is added by default to the list of temporary files to clean up even before parsing starts. '#cmdline "-RR"' doesn't restart the parser and so gives the effect of doing nothing.
#cmdline "-exx -gen gcc -RR"
#macro errload
Print "Error handler active."
Dim errnum as long
On Error Goto ehandler
#endmacro
#macro errhandle
Goto skipover
ehandler:
Errnum = Err()
Print "ERROR ";Errnum;" ";
Select Case as const Errnum
case 0: Print " ... "
Case 1 :Print "Illegal function call"
Case 2 :Print "File not found signal"
Case 3 :Print "File I/O error"
Case 4 :Print "Out of memory"
Case 5 :Print "Illegal resume"
Case 6 :Print "Out of bounds array access"
Case 7 :Print "Null Pointer Access"
Case 8 :Print "No privileges"
Case 9 :Print "interrupted signal"
Case 10 :Print "illegal instruction signal"
Case 11 :Print "floating point error signal"
Case 12 :Print "segmentation violation signal"
Case 13 :Print "Termination request signal"
Case 14 :Print "abnormal termination signal"
Case 15 :Print "quit request signal"
Case 16 :Print "return without gosub"
Case 17 :Print "end of file"
End Select
Print "Function: " &__function__
#ifdef __FB_LANG__
#if __FB_LANG__ = "qb"
Print "Module: " & *__Ermn
#else
Print "Module: " & *Ermn
#endif
#endif
Print "Line: " & Erl
Print "Press a key to exit"
'Sleep
'End
skipover:
#endmacro
errload
type tudt
aaa as INTEGER
bbb as INTEGER
End Type
dim as tudt udt
dim as any ptr ptrbuffer
dim as uinteger tempvar
asm nop '''added for an easy search
TempVar = *Cast(Uinteger Ptr, ptrBuffer)
asm nop
errhandle
var file= rtrim(command(0),".exe")+".asm"
shell "notepad "+file
kill file
sleep
The .asm exists while notepad shows it, as you can see it gets deleted afterwards to declutter your folder.
I had a lengthy command line but reduced it to only: -RR -gen gcc
Optimization from -O 1 and above and the above is not displayed.
I am now going to have some fun because there are many BASIC statements that I should like to see deciphered. I don't use #cmdline - I edit the command line using my SerCompilerSwitches.exe in WinFBE.
I:\WinFBE_Suite\TMPAF54.bas(63) error 24: Invalid data types
I:\WinFBE_Suite\TMPAF54.bas(65) error 20: Type mismatch
I:\WinFBE_Suite\TMPAF54.bas(66) error 58: Type mismatch, at parameter 1 of KILL()
Thanks all.
No problem with command line flags.
Deltarho
I usually test this kind of stuff with direct console compile, I cannot use fbide anyway because of uppercase -RR if I were to use switches.
All derived filetypes from the source, (.exe,.asm,.c,.a,.dll, . . . ) appear alongside the original .bas file, direct console compile will at least guarantee this behaviour.
(Just a thought)