Search found 163 matches

by cbruce
Jan 25, 2022 4:00
Forum: Sources, Examples, Tips and Tricks
Topic: Rotate bits and bytes
Replies: 1
Views: 928

Rotate bits and bytes

I use integer and string rotations a lot in different code bases so I roll my own... ' // ------------------------------------------------------------ ' // MACROs to Rotate Any *Unsigned* Integer's Bits Right or Left. ' // ------------------------------------------------------------ ' ' ------------...
by cbruce
May 31, 2021 17:56
Forum: General
Topic: FB RANDOMIZE() and RND() seed parameters ignore the mantissa
Replies: 30
Views: 2235

FB RANDOMIZE() and RND() seed parameters ignore the mantissa

Took me a while to figure out what was screwing up what I thought was some very simple code... (maybe needs a documentation addition?) Although Randomize() takes a DOUBLE for a seed parm and RND() takes a SINGLE for a seed parm, any mantissa on those values is ignored. Only the INTEGER portion of th...
by cbruce
Apr 13, 2021 20:14
Forum: General
Topic: Will this array subscript warning bite me later?
Replies: 13
Views: 1907

Re: Will this array subscript warning bite me later?

Thanks @deltarho and @coderJeff !!
The flag and the additional "-Wc" works great!
[edit] ... as does the comma separation!
by cbruce
Apr 13, 2021 19:10
Forum: General
Topic: Will this array subscript warning bite me later?
Replies: 13
Views: 1907

Re: Will this array subscript warning bite me later?

There's a specific gcc optimization -ftree-vrp that is enabled with -O2 or higher. Disabling this one optimization also disables the bounds warning. fbc-win64 array.bas -O 3 -Wc -fno-tree-vrp I use the latest WinFBE, so i don't know if it is related to the WinFBE build of FreeBASIC or not... but wh...
by cbruce
Apr 11, 2021 1:13
Forum: General
Topic: [Solved] - Program hangs on MultiKey()?
Replies: 8
Views: 735

[Solved] = Program hangs on MultiKey()?

For years, I have run a portable app called Console that let's me run multiple tabbed console windows at the same time. I just went and ran my code in a straight Windows CMD.exe console and MultiKey() runs as expected. Something in Console Portable is grabbing the keyboard input and not letting the ...
by cbruce
Apr 11, 2021 0:26
Forum: General
Topic: [Solved] - Program hangs on MultiKey()?
Replies: 8
Views: 735

Re: Program hangs on MultiKey()?

@MrSwiss, does the stub compile and run for you? Does it get the file error and get to the sub that calls MultiKey()? And does it hang the program then for you?
by cbruce
Apr 11, 2021 0:12
Forum: General
Topic: [Solved] - Program hangs on MultiKey()?
Replies: 8
Views: 735

Re: Program hangs on MultiKey()?

Hmm... curious, why would a WinFBE update matter?

Anyway, I am on the latest build of WinFBE - and I have tried it with both gcc 5.2 and 8.4, with and without optimizations.

Once MultiKey(SC_ESC), etc. is called - the program just hangs. I can only get out of it with a Ctrl-Break.
by cbruce
Apr 11, 2021 0:05
Forum: General
Topic: Will this array subscript warning bite me later?
Replies: 13
Views: 1907

Re: Will this array subscript warning bite me later?

Thanks @MrSwiss. gcc 5.2 shows no warnings with this code!
by cbruce
Apr 11, 2021 0:01
Forum: General
Topic: [Solved] - Program hangs on MultiKey()?
Replies: 8
Views: 735

Re: Program hangs on MultiKey()?

Thanks for the use of FileExists(), but I still have the MultiKey() question.

If you put a couple of PRINTs in, you will find that the code stub gets into the the IF ERR code, calls Wait_For_ESC_or_CtrlC__Then_Return(), and then sits there comfortably forever.
by cbruce
Apr 10, 2021 23:07
Forum: General
Topic: Will this array subscript warning bite me later?
Replies: 13
Views: 1907

Will this array subscript warning bite me later?

. Windows 10 64-bit program compiles and runs ok as far as I can tell, but gets an array subscript warning when compiled with gcc -O2, -O3, or -Ofast optimization options. Is this something to be worried about? The code stub below compiles and can show the warning that I am asking about if you use o...
by cbruce
Apr 10, 2021 22:50
Forum: General
Topic: [Solved] - Program hangs on MultiKey()?
Replies: 8
Views: 735

[Solved] - Program hangs on MultiKey()?

. Program hangs forever when trying to get user input of [ESC] or [Ctrl-C] with MultiKey(). Windows 10 64-bit FreeBASIC-1.07.1-gcc-8.4 (same hang with/without gcc optimizations) #include once "fbgfx.bi" #if __FB_LANG__ = "fb" Using FB '' Keyboard scan code constants are stored in...
by cbruce
Apr 06, 2021 17:20
Forum: General
Topic: Infinite loop UBYTE For loop index problem?
Replies: 12
Views: 1027

Infinite loop UBYTE For loop index problem?

Shouldn't I be able to use a UBYTE as an index in a For loop of 0 to 255? print "I'm using 64-bit FB VERSION on Windows 10 --> .\FreeBASIC-1.07.1-gcc-8.4\fbc64.exe" '' Error? '' I get an infinite loop when using a UBYTE index of 0 to 255. '' Works fine if I limit it to 254. dim as ubyte i ...
by cbruce
Nov 03, 2019 20:04
Forum: Projects
Topic: WinFBE Editor and FreeBASIC Compiler (All-in-One Package) (V3.1.0 June 4, 2023)
Replies: 979
Views: 344228

Re: WinFBE Editor and FreeBASIC Compiler (All-in-One Package) (Updated November 2, 2019)

Paul, there are a lot of duplicated keywords in the freebasic_keywords.txt file. Is this intentional? Example: oct oct$ oct$ off offset on on once open open operator option option or out out output output If you want it, here's a sorted, deduplicated copy of the file from the 1.9.7 release: #define ...
by cbruce
May 21, 2019 17:09
Forum: General
Topic: How do you interoperate with other applications using double-precision floating-point?
Replies: 15
Views: 3057

Re: How do you interoperate with other applications using double-precision floating-point?

Hi srvaldez, That's my whole problem... none of them return the exact same results. So, for now, I'm writing it to have different implementations make a first attempt with a truncated (not rounded) 15 digits of precision. If that doesn't allow for equivalency checks, then we'll drop it down to 14 di...
by cbruce
May 21, 2019 16:11
Forum: General
Topic: How do you interoperate with other applications using double-precision floating-point?
Replies: 15
Views: 3057

Re: How do you interoperate with other applications using double-precision floating-point?

.
Thanks srvaldez, but it looks like no one can verify it between different compilers/platforms without a LOT of testing. So now I'm just trying to figure out which way I want to work around the issue in my application (as described above).