Blog post !
Re: Blog post !
@Fred
I expect optimized C to match ASM for simple stuff. Glad to hear it is working.
I also prefer to run final code from the ide no matter the delay.
My use case for a GetCaller() Macro is to avoid virtual tables with some libs.
I have Structures with embedded Prototypes to a Procedure.
I will wait to see the exposed C or inline C approach.
I expect optimized C to match ASM for simple stuff. Glad to hear it is working.
I also prefer to run final code from the ide no matter the delay.
My use case for a GetCaller() Macro is to avoid virtual tables with some libs.
I have Structures with embedded Prototypes to a Procedure.
I will wait to see the exposed C or inline C approach.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Re: Blog post !
@Fred - I assume we will have a selection panel or some code switches to set individual C optimizations?
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
-
- Addict
- Posts: 1518
- Joined: Wed Nov 12, 2008 5:01 pm
- Location: Russia
Re: Blog post !
Fred, what C code will be compiled from this PB code?
Code: Select all
Procedure.s Test(x, y, z.s)
ProcedureReturn Str(x+y)+z
EndProcedure
GCC supports several levels of optimization (-O0, O1, etc.). Does the directive allow them to be set? Also GCC using __attribute__ can set the level of optimization of a function. Will this be possible in PB?Fred wrote:There is a new compiler directive to control optimization from code: 'EnableCodeOptimizer'
Code: Select all
__attribute__((optimize("-O2")))
void Test(void)
{
}
- StarBootics
- Addict
- Posts: 1006
- Joined: Sun Jul 07, 2013 11:35 am
- Location: Canada
Re: Blog post !
Hello everyone,
I have another question : Are the Interface/EndInterface will be impacted by this change ?
Best regards
StarBootics
I have another question : Are the Interface/EndInterface will be impacted by this change ?
Best regards
StarBootics
The Stone Age did not end due to a shortage of stones !
Re: Blog post !
Yes, it is, especially with a bloated system like GCC. For example, I was testing a compiler that generated asm macros, and short short code took very long for their length, with 99 percent of the compilation time in the assembler. It was so significant that I hand wrote my own macro expander... Then compilation was nearly instant.jacdelad wrote:Is compilation speed really so important? I only have small projects which never take then more than 3 seconds or something, usually less.
Re: Blog post !
It's BASIC and should stay BASIC!User_Russian wrote:...
I think that gosub can be abandoned.
...
YES!jacdelad wrote:Is compilation speed really so important?
...

Re: Blog post !
i would've thought GOSUB and GOTO could easily be implemented with a single inline asm call or jmp respectively
Re: Blog post !
It probably can, but I'm with User_Russian... Gosub can be obsoleted. We've got procedures, for crying out loud...Keya wrote:i would've thought GOSUB and GOTO could easily be implemented with a single inline asm call or jmp respectively
-
- Addict
- Posts: 1518
- Joined: Wed Nov 12, 2008 5:01 pm
- Location: Russia
Re: Blog post !
In C there Goto and its scope as in PB.
That is, there should be no problems.
That is, there should be no problems.
Re: Blog post !
I think everyone should relax
Fred & team know PureBasic internals better than all of us. They know the pros and cons of what they're doing, and I'm sure they'll make it as backwards-compatible as possible. Also, it's the PB team... you know they love simplified toolchains and fast write-and-run cycles!
It's newly announced, and some people are already asking for specific C output for PB input snippets?! Too soon

Fred & team know PureBasic internals better than all of us. They know the pros and cons of what they're doing, and I'm sure they'll make it as backwards-compatible as possible. Also, it's the PB team... you know they love simplified toolchains and fast write-and-run cycles!
It's newly announced, and some people are already asking for specific C output for PB input snippets?! Too soon

- StarBootics
- Addict
- Posts: 1006
- Joined: Sun Jul 07, 2013 11:35 am
- Location: Canada
Re: Blog post !
I hope you are right, because I don't want to see my Dev-Object program generating broken code for future version of PureBasic. I know I can stick with the 5.73 LTS version from now on but I don't like to do that. That's why I have some questions, and from my perspective it is legitimate considering the many hours of hard work I put in my programming projects already (Dev-Object and my 3D game project just to name a few).kenmo wrote:I think everyone should relax![]()
Fred & team know PureBasic internals better than all of us. They know the pros and cons of what they're doing, and I'm sure they'll make it as backwards-compatible as possible. Also, it's the PB team... you know they love simplified toolchains and fast write-and-run cycles!
It's newly announced, and some people are already asking for specific C output for PB input snippets?! Too soon
Best regards
StarBootics
The Stone Age did not end due to a shortage of stones !
Re: Blog post !
Exactly why I want the option to extend structures with procedures so we get instance-style programming finally easy for the ones wanting it. Up to now we have to resort to hacks of various complexity and too much boiler plate code... one simple addition...skywalk wrote:@Fred
My use case for a GetCaller() Macro is to avoid virtual tables with some libs.
I have Structures with embedded Prototypes to a Procedure.
I will wait to see the exposed C or inline C approach.
Also inline array declaration like in c is a must in select use cases...
Also a more efficient string type. Length prefixed. So it can contain binary data to. Never use special data to control the same data (0-termination...). There various c libs available that attempt to solve that while still having backward compatibility where needed.
Open minded

Re: Blog post !
Don't forget that for speed-critical routines, calling Procedures is slower than using Gosub, and all variables inside a Procedure are set to 0/null when the Procedure starts (unless Global or Shared). I say keep it in for compatibility and speed options.Tenaja wrote:Gosub can be obsoleted. We've got procedures
Re: Blog post !
There's no such thing as a local variable in a subroutine... So write your procedures with globals, and you have the same call speed... And the same visibility of their variables.BarryG wrote:Don't forget that for speed-critical routines, calling Procedures is slower than using Gosub, and all variables inside a Procedure are set to 0/null when the Procedure starts (unless Global or Shared). I say keep it in for compatibility and speed options.Tenaja wrote:Gosub can be obsoleted. We've got procedures
Re: Blog post !
[Deleted]
Last edited by BarryG on Tue Mar 16, 2021 6:00 am, edited 4 times in total.