Search found 428 matches
- Dec 06, 2019 17:25
- Forum: General
- Topic: Checking if an array is empty.
- Replies: 5
- Views: 954
Checking if an array is empty.
I noticed in the documentation: '' determining whether an array is empty Dim array() As Integer Print "lbound: "; LBound( array ), "ubound: "; UBound( array ) '' 1 and 0 If LBound( array ) > UBound( array ) Then Print "array is empty" Else Print "array is not empty...
- Nov 16, 2019 21:59
- Forum: General
- Topic: Ptr to an array? (Was: Possible to ReDim with only a ptr?)
- Replies: 10
- Views: 1943
Re: Ptr to an array? (Was: Possible to ReDim with only a ptr?)
Maybe mrToad needs to be able to pass an array to a procedure using a pointer only as argument. Yes, that's what I feel I need to do, exactly! It's nice to see that it's now possible to point to an array descriptor in 1.08! (Although I didn't find the download yet; I'll try your code suggestion for...
- Nov 16, 2019 1:20
- Forum: General
- Topic: GCC compile delay on large projects?
- Replies: 14
- Views: 5698
Re: GCC compile delay on large projects?
@coderJeff, that insight really does help explain things.
I'm not sure where in my project there are heavy Data statements though, maybe tucked away in an old attached lib, I will look. I don't care for them anyway, but it's nice to understand the problem. Thanks for your reply.
I'm not sure where in my project there are heavy Data statements though, maybe tucked away in an old attached lib, I will look. I don't care for them anyway, but it's nice to understand the problem. Thanks for your reply.
- Nov 16, 2019 1:09
- Forum: General
- Topic: Ptr to an array? (Was: Possible to ReDim with only a ptr?)
- Replies: 10
- Views: 1943
Re: Possible to ReDim with only a ptr?
Thanks both of you. I didn't think so, but I imagined maybe, by backing up in memory to the first element and using SizeOf to reach the header or something. It's fine to confirm that it's not possible. :) @angros47, thanks, I am familiar with that method, and it is best in most cases. The real reaso...
- Nov 13, 2019 16:51
- Forum: General
- Topic: Ptr to an array? (Was: Possible to ReDim with only a ptr?)
- Replies: 10
- Views: 1943
Ptr to an array? (Was: Possible to ReDim with only a ptr?)
I've never done something like this so I was wondering if it's even possible. ReDim an array with only a pointer to it? Type udt As Long x End Type Sub test(a As udt Ptr = 0) If a Then Print a[0].x ReDim Preserve @a(1 To 10) '' This is obviously wrong, but is it possible to code somehow? Print a[0]....
- Oct 25, 2019 16:44
- Forum: General
- Topic: Quick question on Enum's data type
- Replies: 33
- Views: 3645
Re: Quick question on Enum's data type
One thing that comes to mind now, I don't think FB had as much capability for object oriented coding back when I made that GUI. It all depends when you have coded your GUI. Yea, I couldn't remember before. Now I found that I posted the original version in 2010: https://www.freebasic.net/forum/viewt...
- Oct 25, 2019 16:22
- Forum: General
- Topic: YouTube increases FreeBASIC performance (solved)
- Replies: 6
- Views: 1131
Re: YouTube increases FreeBASIC performance (solved)
That's why I still have a reluctance to use SLEEP with a value <15 ms (under Windows), because the actual value applied may depend on the context (timeBeginPeriod()/timeEndPeriod() not multitasking safe). After I read this I went and tested something: If Sleep(16,1) gives right around a desired 60 ...
- Oct 25, 2019 15:43
- Forum: General
- Topic: Quick question on Enum's data type
- Replies: 33
- Views: 3645
Re: Quick question on Enum's data type
I don't remember if there's a formal word for UDT items ... The word you are looking for, is: type member ... Thank you. That will help me sound less confusing. @fxm, That's right, of course. I recall Properties from Visual Basic. I used to code VB for years and later the word Properties got into m...
- Oct 24, 2019 15:55
- Forum: General
- Topic: GCC compile delay on large projects?
- Replies: 14
- Views: 5698
Re: GCC compile delay on large projects?
@srvaldez, GCC : 522kb (~6 seconds wait to finish compile to exe) GCC -Wc -O3 : 489kb (~10 seconds wait to finish compile to exe) GAS: 423kb (~1 second wait to finish compile to exe) @dodicat, I tested that code, it took a couple minutes for a 640x480 bitmap. Wow, interesting, very slow. I found ~10...
- Oct 24, 2019 15:29
- Forum: General
- Topic: Quick question on Enum's data type
- Replies: 33
- Views: 3645
Re: Quick question on Enum's data type
I was just referring to the way I was originally doing it. Type Block Enum Shapes circle = 1 square triangle End Enum As Shapes Shape End Type This above UDT has not the same size when compiled in 32-bit/64-bit (4-byte/8-byte). Yes, exactly, that's what I mean. Sorry, the way I wrote the last messa...
- Oct 24, 2019 15:12
- Forum: General
- Topic: Quick question on Enum's data type
- Replies: 33
- Views: 3645
Re: Quick question on Enum's data type
I was just referring to the way I was originally doing it.fxm wrote:Such a UDT has the same size when compiled in 32-bit and 64-bit:
Code: Select all
Type Block
Enum Shapes
circle = 1
square
triangle
End Enum
As Shapes Shape
End Type
- Oct 24, 2019 14:50
- Forum: General
- Topic: Quick question on Enum's data type
- Replies: 33
- Views: 3645
Re: Quick question on Enum's data type
Since the thread question has already been satisfied and beyond, I just want to say first that it's totally fine with me to open it up to anything else you guys want, so keep posting whatever comes to your mind :) I've been learning from the discussion. You talk about a largish UDT (how big really?)...
- Oct 24, 2019 13:28
- Forum: General
- Topic: Quick question on Enum's data type
- Replies: 33
- Views: 3645
Re: Quick question on Enum's data type
A pretty interesting discussion has been struck up here. First, thanks for the solutions earlier all of you. I can make use of the code for sure. So long as you remember that on retrieving any file udt data (using enum) you must use integer<32> ~ long. Well, the problem is trying to avoid separate c...
- Oct 21, 2019 22:28
- Forum: General
- Topic: Quick question on Enum's data type
- Replies: 33
- Views: 3645
Re: Quick question on Enum's data type
Thank you both. Just wanted to see if there was any way to use Enum in UDT without this issue. Any suggestions on a different solution to provide similar convenience as Enum in a UDT? It's just nice to have something like below for code clarity: Enum Shapes circle = 1 square triangle End Enum Type B...
- Oct 21, 2019 20:57
- Forum: General
- Topic: Quick question on Enum's data type
- Replies: 33
- Views: 3645
Quick question on Enum's data type
If a UDT contains something Dim'd as an Enum, it's bytes are SizeOf = 8 when compiled with win64. If this is to be written/read from file, how can the Enum be safe between win 32/64? I would like to set it as Long, the same as Const As Long, but I don't see a way to do so with Enum. '' Enum types ar...