Search found 356 matches
- Dec 11, 2018 2:27
- Forum: Sources, Examples, Tips and Tricks
- Topic: Stack CPU Emulation
- Replies: 1
- Views: 842
Re: Stack CPU Emulation
Nice stack. There is one allocated but unused memory slot at d + 0. So you can actually store 1025 integers without reallocating space. You would have to override some code in push/pop to get at it though. Here is a test that shows stack slot at d+ 0 exists. type stack id as integer ptr d as integer...
- Dec 10, 2018 7:25
- Forum: Sources, Examples, Tips and Tricks
- Topic: Insert/Replace String procedures
- Replies: 38
- Views: 5778
Re: Insert/Replace String procedures
@jj2007 I haven't run the code (because I'm on Linux tonight) but I have some questions. Firstly something seems strange here: You declare a global variable retStr and then in the replace function you actually return that variable. That seems odd to me. In your test code you store the returned value...
- Dec 08, 2018 1:58
- Forum: General
- Topic: How to fix error 177 ???
- Replies: 40
- Views: 4073
Re: How to fix error 177 ???
@mrminecrafttnt There is another alternative that I like to use. When there is a chance that a function may return an unusable result, set it up as a boolean return value and use either a pointer to the desired return type or a byref parameter. Return true when the return value is valid and false wh...
- Dec 03, 2018 3:42
- Forum: Sources, Examples, Tips and Tricks
- Topic: Get String Characters 4x Faster than Mid()
- Replies: 83
- Views: 9317
Re: Get String Characters 4x Faster than Mid()
Nice tip Munair: Using a union is even faster from what I can see. #define StrNOf(s, n) strptr(s)[n] type char as string * 1 Union uchar As String * 1 s As Ubyte c End Union dim as string s1 = "Hello test 2" dim as char c dim as double t dim As uchar uc print "by union:" t = time...
- Dec 02, 2018 22:57
- Forum: General
- Topic: Too restrictive compilation control on dynamic arrays in the main code?
- Replies: 30
- Views: 3782
Re: Too restrictive compilation control on dynamic arrays in the main code?
Because the colon operator ':' separates command lines. The left side is one line, the right another.Haubitze wrote:what, why not? ;D
Bear in mind that you could write an entire FreeBASIC program on one line using the colon.
- Nov 27, 2018 6:34
- Forum: General
- Topic: Is there existing an inputroutine?
- Replies: 46
- Views: 6257
Re: Is there existing an inputroutine?
@dodicat Your routine does not work with ubuntu. There is no cursor and left and right don't seem to do anything (its hard to tell because there is no cursor) @grindstone Works great except for the delete key. To replicate the problem type abcdefg, left key to 'd' and press delete. The 'd' is replac...
- Nov 25, 2018 5:03
- Forum: Sources, Examples, Tips and Tricks
- Topic: quick sort in FreeBASIC faster then C-Lib
- Replies: 10
- Views: 2044
Re: quick sort in FreeBASIC faster then C-Lib
@DJ
You are correct
You are correct
- Nov 24, 2018 7:37
- Forum: Sources, Examples, Tips and Tricks
- Topic: quick sort in FreeBASIC faster then C-Lib
- Replies: 10
- Views: 2044
Re: quick sort in FreeBASIC faster then C-Lib
edit: flawed post
- Nov 21, 2018 1:30
- Forum: Sources, Examples, Tips and Tricks
- Topic: Proper Case / Title Case
- Replies: 10
- Views: 2535
Re: Proper Case / Title Case
If you change the parameter to byref then you avoid making an internal copy of the string. In fact you can change both the parameter and the return to byref. I have tested the speed of lcase in the past and it is very fast. So I am not sure if it is at all worth changing but here is your code withou...
- Nov 18, 2018 19:47
- Forum: Documentation
- Topic: How to Replace Any Recursion with Simple Iteration or Unlimited Iteration with its Own Stack, in FB
- Replies: 23
- Views: 12068
Re: How to Replace Any Recursion with Simple Iteration or Unlimited Iteration with its Own Stack, in FB
That is the macro method of implementing generic-like types. #define defines a macro. Instead of wrapping the type directly inside a macro you have the namespace. But for sure without the #define (macro) you can't isolate the type. Still the problem similar to a host of if/else. You now have a host ...
- Nov 18, 2018 9:31
- Forum: Documentation
- Topic: How to Replace Any Recursion with Simple Iteration or Unlimited Iteration with its Own Stack, in FB
- Replies: 23
- Views: 12068
Re: How to Replace Any Recursion with Simple Iteration or Unlimited Iteration with its Own Stack, in FB
@badidea: That is called generics. This is a current wishlist item for fb. The answer is no you can't, without jumping through some ugly hoops. You can try to build your list with any pointers but then you will either fill your comparison method code full of if/else (if myobject is string elseif myo...
- Nov 18, 2018 1:56
- Forum: General
- Topic: WITH .. END WITH Scope
- Replies: 5
- Views: 643
Re: WITH .. END WITH Scope
Since this would only be a matter for variables created in the with block (and not for any other statements therein) maybe using the .. context modifier such as:
Code: Select all
With a
..Dim as integer n
end with
- Nov 17, 2018 2:06
- Forum: General
- Topic: WITH .. END WITH Scope
- Replies: 5
- Views: 643
Re: WITH .. END WITH Scope
However, with objects, there are situations when with .. end with cannot be used because of its scope nature. The following snippet cannot be run, but demonstrates such a situation: Can you clarify what you mean by this? Its not immediately clear (to me) why with/end with cannot be used in the post...
- Nov 13, 2018 7:05
- Forum: Community Discussion
- Topic: Forum Moderators
- Replies: 19
- Views: 5237
Re: Forum Moderators
@anonymous1337: Yes he handled that thread poorly. However, the point he was making was echoed by counting pine in tips and tricks, wherein he wants posters in that thread to not just post code but explain it. In this case I believe (not %100 sure) mrminecraft is ESL (English as a second language) a...
- Nov 13, 2018 6:27
- Forum: Sources, Examples, Tips and Tricks
- Topic: Multikey key release
- Replies: 16
- Views: 4338
Re: Multikey key release
@Dodicat: I didn't see your state variable before. It looks interesting and the demo works great. I dd a state variable as well. Mine was rudimentary compared to this. Just a variable field (integer) and a boolean set to true when the variable was first set to a value. I had the notion that I would ...