![]() |
|
Function Pointers? - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: Chatting and Socializing (https://qb64phoenix.com/forum/forumdisplay.php?fid=11) +--- Forum: General Discussion (https://qb64phoenix.com/forum/forumdisplay.php?fid=2) +--- Thread: Function Pointers? (/showthread.php?tid=4490) |
Function Pointers? - BlameTroi - 02-19-2026 I tried searching but didn't see anything... It's an odd request, but I'm a big fan of function pointers/dispatch tables. I always want one more level of indirection ![]() Using a big Select Case instead of an array of a UDT type with a pointer will get the job done and is no hardship, but it never hurts to ask. so this is more of a want than a need and it's certainly not a typical Basic sounding thing. As an aside I've been "futzing" around with QB64PE for the past couple of weeks and the experience on the Mac has been great. I've tried a few times in the past but kept drifting away. Solid work you all have been doing. RE: Function Pointers? - ahenry3068 - 02-19-2026 I'm onboard with this. BUT I'M NOT A COMPILER DEV ! It is kind of outside of what BASIC normally is and I woudn't hold my breath. I do know you can work with function pointers in a C interface library to the main program but that isn't the same ! Depending on use case you want I've used Conditional compilation to do a kind of sort of call back type function, but that really isn't the same thing (But might be a road to explore for certain applications !) RE: Function Pointers? - luke - 02-19-2026 There's been some consideration of the idea (see https://github.com/QB64-Phoenix-Edition/QB64pe/issues/48) but it probably won't be happening in the near future. Lots of prickly edge cases. RE: Function Pointers? - BlameTroi - 02-20-2026 (02-19-2026, 08:50 PM)luke Wrote: There's been some consideration of the idea (see https://github.com/QB64-Phoenix-Edition/QB64pe/issues/48) but it probably won't be happening in the near future. Lots of prickly edge cases.Yeah I can see that. Thanks. I need to make sure my searches pick up the repo too. RE: Function Pointers? - hsiangch_ong - 02-20-2026 if you think you need function pointers. program in c++. otherwise wait until this dialect of basic. develops more oop-like features. if this is too much to take. switch to freebasic. which supports oop more or less like microsoft visual basic. however if you really need the "advanced" graphics and sound. that qb64 phoenix provides. you need to look at what could require function pointers. try to do it in c++ or other language. because someone who thinks he/she needs function pointers. will also ask for variable number of subprogram parameters. multiple return values from function. function and operator overloading. so on and so forth. as i've said, oop-like features. it could be handled creatively. by writing one subprogram. which has select case... end select to go through possible "mini-methods." or handle that selection in the "main program." with many custom subprograms to choose from. the difference is that there's no need. not even in c/c++ to use pointers for it. just integers or maybe key string values. to select what should be called. (shrugs) RE: Function Pointers? - BlameTroi - 02-20-2026 I only want function pointers because I'm lazy and do old style table driven code. A definite want but by no means a need. As I said, a big select is no hardship, just checking. |