There's no difference between using a constant and using the literal value.
PB literally replaces all constants with their values wherever they occur.
However, using constants for Gadgets instead of #PB_Any will waste space if you leave gaps
between the IDs. For example, if you create a gadget with ...
Search found 963 matches
- Wed Sep 25, 2019 6:02 am
- Forum: Coding Questions
- Topic: Do Constants help speed up your Program ?
- Replies: 15
- Views: 3843
- Tue Apr 02, 2019 5:48 am
- Forum: Announcement
- Topic: Happy Birthday, Fred!
- Replies: 18
- Views: 8979
Re: Happy Birthday, Fred!
This ought to be the 15th topic giving a chance to say happy birthday to Fred since I started using PB. Time flies...
Happy birthday!

Happy birthday!
- Wed Nov 07, 2018 1:05 pm
- Forum: General Discussion
- Topic: Need help about future decision of my PB apps
- Replies: 18
- Views: 6225
Re: Need help about future decision of my PB apps
From a business perspective, I'd recommend to move on to another language that enjoys a wider community and more support. While PB has it's advantages (hence I still frequently use it for prototyping), it's a niche language with little support and a very small ecosystem (comparatively).
However, if ...
However, if ...
- Sun Apr 01, 2018 5:39 pm
- Forum: Mac OSX
- Topic: StartDrawing(): The specified output is NULL (0 value)
- Replies: 6
- Views: 3830
Re: StartDrawing(): The specified output is NULL (0 value)
Alright, weird...
Really looks to me as if there is something asynchronous going on.
A Delay(200) just before the main loop seems to prevent the issue from occurring...

Really looks to me as if there is something asynchronous going on.
A Delay(200) just before the main loop seems to prevent the issue from occurring...
- Sun Apr 01, 2018 5:36 pm
- Forum: Mac OSX
- Topic: StartDrawing(): The specified output is NULL (0 value)
- Replies: 6
- Views: 3830
Re: StartDrawing(): The specified output is NULL (0 value)
@mk-soft
Your code from your first answer seems to work, however, when I remove the timer bit and change it to the following it starts crashing occasionally as well.
Could there some asynchronous initialization be going on behind the scenes where ScreenOutput sometimes gets called before everything ...
Your code from your first answer seems to work, however, when I remove the timer bit and change it to the following it starts crashing occasionally as well.
Could there some asynchronous initialization be going on behind the scenes where ScreenOutput sometimes gets called before everything ...
- Sun Apr 01, 2018 1:11 pm
- Forum: Mac OSX
- Topic: StartDrawing(): The specified output is NULL (0 value)
- Replies: 6
- Views: 3830
Re: StartDrawing(): The specified output is NULL (0 value)
The lines beginning with Debug will only compiled if the debugger is turned on.
Yes, I know. :) I did that to check whether any of the Init/Open commands fail, they don't and they never do.
What I'm saying is: the code above works sometimes and sometimes doesn't, completely randomly,
and I have ...
Yes, I know. :) I did that to check whether any of the Init/Open commands fail, they don't and they never do.
What I'm saying is: the code above works sometimes and sometimes doesn't, completely randomly,
and I have ...
- Fri Mar 30, 2018 12:25 pm
- Forum: Mac OSX
- Topic: StartDrawing(): The specified output is NULL (0 value)
- Replies: 6
- Views: 3830
StartDrawing(): The specified output is NULL (0 value)
Hey :)
I have to use OSX for work and wanted to see how well PB works on it.
Was off to a great start, but I soon encountered a problem I have no solution for:
StartDrawing(): The specified output is NULL (0 value).
Debug InitSprite()
Debug OpenWindow(0, 0, 0, 800, 600, "")
Debug ...
I have to use OSX for work and wanted to see how well PB works on it.
Was off to a great start, but I soon encountered a problem I have no solution for:
StartDrawing(): The specified output is NULL (0 value).
Debug InitSprite()
Debug OpenWindow(0, 0, 0, 800, 600, "")
Debug ...
- Thu Mar 22, 2018 6:04 pm
- Forum: Coding Questions
- Topic: Compilation problem!
- Replies: 6
- Views: 2208
Re: Compilation problem!
Might be a unicode / ASCII problem, but it's hard to say. You really have to provide some source code example that reproduces the problem.
- Sat Feb 10, 2018 1:37 am
- Forum: Feature Requests and Wishlists
- Topic: New command "IsMemoryID(*memoryID)
- Replies: 21
- Views: 6815
Re: New command "IsMemoryID(*memoryID)
a IsMemoryID() function to check if a memory ID is still valid
A memory ID is just a pointer to a given address in RAM. It's always going to be valid, even if that memory is freed.
While this is true that the pointer is still valid (since it is just a regular integer variable), dereferencing (i ...
A memory ID is just a pointer to a given address in RAM. It's always going to be valid, even if that memory is freed.
While this is true that the pointer is still valid (since it is just a regular integer variable), dereferencing (i ...
- Thu Jan 25, 2018 9:23 am
- Forum: Off Topic
- Topic: Firefox Quantum - oh, the speed!
- Replies: 20
- Views: 6820
Re: Firefox Quantum - oh, the speed!
AFAIK, the reason why the new Firefox feels faster hasn't much to do with JavaScript performance but more
with its CSS rendering engine that's now multi-threaded (thanks to the Servo project and the Rust programming language).
Browser vendors tried to parallelize this before but failed (Mozilla ...
with its CSS rendering engine that's now multi-threaded (thanks to the Servo project and the Rust programming language).
Browser vendors tried to parallelize this before but failed (Mozilla ...
- Thu Dec 14, 2017 1:55 pm
- Forum: Feature Requests and Wishlists
- Topic: Improved line continuation
- Replies: 29
- Views: 14686
Re: Improved line continuation
Limiting lines to 80 characters (not 60) is actually really common and has little to do with screen size
but with readability. Reading code that has excessively long lines is a nightmare.
@Mistrel
Alright, I get now what you mean. It's still a terrible idea in my opinion.
@Josh
Yes, what we have ...
but with readability. Reading code that has excessively long lines is a nightmare.
@Mistrel
Alright, I get now what you mean. It's still a terrible idea in my opinion.
@Josh
Yes, what we have ...
- Wed Dec 13, 2017 5:29 am
- Forum: Feature Requests and Wishlists
- Topic: Improved line continuation
- Replies: 29
- Views: 14686
Re: Improved line continuation
It wouldn't work, because the compiler would have to treat anything after a semicolon (i.e. comment) as a continuation, so it would inevitably break all code.
Would have to be treated as
Code: Select all
If a ;
Debug a
EndIf
Code: Select all
If a Debug a
EndIf
- Wed Nov 15, 2017 9:00 am
- Forum: Coding Questions
- Topic: Prototype.l (return a long) don't work
- Replies: 10
- Views: 3897
Re: Prototype.l (return a long) don't work
You can mask it.
Procedure.l test()
ProcedureReturn $FFFFFFFF ; = 4294967295
EndProcedure
a.q = test() & $FFFFFFFF
Debug a
Edit:
Not sure I get what you mean. If the command returns a signed 4 byte integer, which it seems it does,
then 4294967295 is equal to -1 because of how they wrap, so you ...
Procedure.l test()
ProcedureReturn $FFFFFFFF ; = 4294967295
EndProcedure
a.q = test() & $FFFFFFFF
Debug a
Edit:
Not sure I get what you mean. If the command returns a signed 4 byte integer, which it seems it does,
then 4294967295 is equal to -1 because of how they wrap, so you ...
- Sat Sep 16, 2017 8:52 am
- Forum: Coding Questions
- Topic: Best Practice for Numeric Types in Structures?
- Replies: 4
- Views: 1704
Re: Best Practice for Numeric Types in Structures?
If you are defining a structure that is to be used as part of an array,
always use the smallest possible type that can fit your data.
Lunasole is correct in that it doesn't matter too much for RAM, however,
it does for cache locality. Having a tightly packed structure allows the CPU
to fit more ...
always use the smallest possible type that can fit your data.
Lunasole is correct in that it doesn't matter too much for RAM, however,
it does for cache locality. Having a tightly packed structure allows the CPU
to fit more ...
- Wed Jul 26, 2017 11:22 pm
- Forum: General Discussion
- Topic: Some thoughts about PB in its current state
- Replies: 42
- Views: 17889
Re: Some thoughts about PB in its current state
I thought you quit? So why do our thoughts matter? What is the point of your post? Why are you bashing PureBasic as you walk out the door and stirring us up? :evil:
It is important to address issues users have with the product in order to improve it; blatant fanboyism doesn't help anyone.
The ...