Search found 397 matches

by mrToad
Nov 16, 2019 21:59
Forum: General
Topic: Ptr to an array? (Was: Possible to ReDim with only a ptr?)
Replies: 9
Views: 347

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...
by mrToad
Nov 16, 2019 1:20
Forum: General
Topic: GCC compile delay on large projects?
Replies: 13
Views: 1290

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.
by mrToad
Nov 16, 2019 1:09
Forum: General
Topic: Ptr to an array? (Was: Possible to ReDim with only a ptr?)
Replies: 9
Views: 347

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...
by mrToad
Nov 13, 2019 16:51
Forum: General
Topic: Ptr to an array? (Was: Possible to ReDim with only a ptr?)
Replies: 9
Views: 347

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]....
by mrToad
Oct 25, 2019 16:44
Forum: General
Topic: Quick question on Enum's data type
Replies: 33
Views: 773

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...
by mrToad
Oct 25, 2019 16:22
Forum: General
Topic: YouTube increases FreeBASIC performance (solved)
Replies: 6
Views: 217

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 ...
by mrToad
Oct 25, 2019 15:43
Forum: General
Topic: Quick question on Enum's data type
Replies: 33
Views: 773

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...
by mrToad
Oct 24, 2019 15:55
Forum: General
Topic: GCC compile delay on large projects?
Replies: 13
Views: 1290

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...
by mrToad
Oct 24, 2019 15:29
Forum: General
Topic: Quick question on Enum's data type
Replies: 33
Views: 773

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...
by mrToad
Oct 24, 2019 15:12
Forum: General
Topic: Quick question on Enum's data type
Replies: 33
Views: 773

Re: Quick question on Enum's data type

fxm wrote:Such a UDT has the same size when compiled in 32-bit and 64-bit:
I was just referring to the way I was originally doing it.

Code: Select all

Type Block
Enum Shapes
   circle = 1
   square
   triangle
End Enum
   As Shapes Shape
End Type
by mrToad
Oct 24, 2019 14:50
Forum: General
Topic: Quick question on Enum's data type
Replies: 33
Views: 773

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?)...
by mrToad
Oct 24, 2019 13:28
Forum: General
Topic: Quick question on Enum's data type
Replies: 33
Views: 773

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...
by mrToad
Oct 21, 2019 22:28
Forum: General
Topic: Quick question on Enum's data type
Replies: 33
Views: 773

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...
by mrToad
Oct 21, 2019 20:57
Forum: General
Topic: Quick question on Enum's data type
Replies: 33
Views: 773

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...
by mrToad
Oct 17, 2019 23:48
Forum: General
Topic: Pan and Zoom 2D with mouse (solved)
Replies: 6
Views: 242

Re: Pan and Zoom 2D with mouse (new code example)

Sorry for the confusion. It's just the zoom effect of most paint/graphics programs I wished to imitate. Anyway, I finally got it now! Here's the code: #Include "fbgfx.bi" #Define RES_W 1280 #Define RES_H 720 Dim As Integer mx,my,ms,mb, old_ms Dim As Integer zoom, pan_x, pan_y, old_pan_x, o...

Go to advanced search