Blog post !
Re: Blog post !
Agreed.
Break n is concise and to the point.
Refactoring nested For Loops with complex conditionals is a nightmare.
Break n is concise and to the point.
Refactoring nested For Loops with complex conditionals is a nightmare.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Re: Blog post !
In well-structured code, conditional loops should always prove to be the most elegant approach.Tenaja wrote:It can be elegant, but if one of the exit conditions is only combined with a handful of other specific conditions (i.e. nested deep in some IF's), placing that whole pile into the conditional loop test can be ugly, confusing, and slower since the condition is tested with every iteration... And is no longer elegant.
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel
Re: Blog post !
Maybe you can add an internal break_level for inner loops?Fred wrote:It's the plan, it's just not implemented yet.User_Russian wrote:Why aren't you using goto?
Bkeak 2 can be translated like this in C.Code: Select all
for (uint8_t i=0; i<10; i++) { for (uint8_t x=1; x<100; i++) { goto break2; // This Bkeak 2 in PB. } } break2:;
Code: Select all
#include <stdio.h>
unsigned long long break_level;
#define break_with_level(level) break_level=level-1; break;
#define check_break_level if(break_level>0) { break_level--; break; }
int main() {
break_level = 0; for (int i=0; i<10; i++) {
break_level = 0; for (int j=0; j<10; j++) {
break_level = 0; for (int k=0; k<10; k++) {
break_with_level(3);
printf("end of k loop\n");
}
check_break_level;
printf("end of j loop\n");
}
check_break_level;
printf("end of i loop\n");
}
return 0;
}
- StarBootics
- Addict
- Posts: 984
- Joined: Sun Jul 07, 2013 11:35 am
- Location: Canada
Re: Blog post !
Hello everyone,
I have some questions about some stuff since C compilers are capable to deal with :
Best regards
StarBootics
I have some questions about some stuff since C compilers are capable to deal with :
- 1. unsigned long and unsigned long long (sorry to ask again)
2. Static arrays outside structures
3. Multi-dimensions static arrays inside and outside structures
4. The possibility initialize static arrays like : ArrayName.f[4] = {0.0, 1.0, 2.0, 3.0}
5. The ternary operator
Best regards
StarBootics
The Stone Age did not end due to a shortage of stones !
Re: Blog post !
Just because a C-compiler is used in the backend does not mean that the C-syntax is adopted into PB! Of course not!
All items you listed are feature request for the PureBasic syntax but they are not directly correlated to the compiler backend change.
All items you listed are feature request for the PureBasic syntax but they are not directly correlated to the compiler backend change.
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Re: Blog post !
Stay cool and wait and see. The first goal should be that Pb under C runs as stable as it does now with the current language set.StarBootics wrote:Will all this be introduced into the PureBasic language
sorry for my bad english
Re: Blog post !
I too remain cool, but want to see the ;;'s dropped from this list?
Code: Select all
; ; Type, Bytes, Min, Max, C Type
;;ul.ul[0] ; ULong, 4, 0, 4294967295, unsigned long, unsigned int, DWORD(C++)
;;uq.uq[0] ; UQuad, 8, 0, 18446744073709551615, unsigned long long, ULONGLONG
;;ld.ld[0] ; LDouble, 10, -3.4e-4932, 1.1e+4932,long double(19 decimal places)
Code: Select all
; #PB_Compiler_Unicode = 1 (PB v5.4+ dropped Ascii compiles)
Structure ScanAllTypes ;-!PB Datatypes
; Allows 1 Define for all datatypes to be scanned.
; Define *p.ScanAllTypes = @somevariable or *somememory
; Consider as a StructureUnion. Takes no memory and overflow is not checked.
; Ex. *p\d[i] ; 'i' can be incremented in a loop without compiler error.
; ; Type, Bytes, Min, Max, C Type
b.b[0] ; Byte, 1, -128, 127, char, bool(C++)
a.a[0] ; Ascii, 1, 0, 255, unsigned char, UCHAR, BYTE
c.c[0] ; Character, 2, 0, 65535, unsigned short, USHORT
u.u[0] ; Unicode, 2, 0, 65535, unsigned short, USHORT
w.w[0] ; Word, 2, -32768, 32767, short, VB6 integer
l.l[0] ; Long, 4, -2147483648, 2147483647, long, int (long & $FFFFFFFF = unsigned)
;;ul.ul[0] ; ULong, 4, 0, 4294967295, unsigned long, unsigned int, DWORD(C++)
i.i[0] ; Integer, 4, -2147483648, 2147483647, long, int(x86 or 32-bit),sizeof*
;i.i[0] ; Integer, 8, -9223372036854775808, 9223372036854775807, long long(x64 or 64-bit),sizeof*
q.q[0] ; Quad, 8, -9223372036854775808, 9223372036854775807, long long
;;uq.uq[0] ; UQuad, 8, 0, 18446744073709551615, unsigned long long, ULONGLONG
f.f[0] ; Float, 4, -1.175494e-38, 3.402823e+38, float (6 decimal places)
d.d[0] ; Double, 8, -2.2250738585072013e-308, 1.7976931348623157e+308, double (15 decimal places)
;;ld.ld[0] ; LDouble, 10, -3.4e-4932, 1.1e+4932,long double(19 decimal places)
;;s.s ; String$, 2/char + 2 for chr(0), , wchar_t, TCHAR
;s.s[0] ; FAIL, -> *p = @x$, *p\s[0] = IMA ERROR.
s.s{1}[0] ; {FixedLen}, 2/char, , char *, char var[] <-- Convert to Ascii
ss.s[0] ; Scan String array.
;s.s[0] ; FAIL, -> *p = @x$(), *p\s[1], *p\s[2], etc.
;s.s[0] ; OK, -> *p = @x$, *p\s[1], *p\s[2], etc.
;ss.s[0] ; OK, -> *p = @x$(), *p\ss[1], *p\ss[2], etc.
EndStructure
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Re: Blog post !
100% correct STARGATE.STARGÅTE wrote:Just because a C-compiler is used in the backend does not mean that the C-syntax is adopted into PB! Of course not!
All items you listed are feature request for the PureBasic syntax but they are not directly correlated to the compiler backend change.
Also Fred said there is no plan to deprecate the Assembly backend... so let's not expect a rush of new C-based features yet!
Hopefully requested bugfixes do not get neglected during work on the C backend, though.
Anyway, for feature requests, +1 for Danilo's procedure-via-structure request
- StarBootics
- Addict
- Posts: 984
- Joined: Sun Jul 07, 2013 11:35 am
- Location: Canada
Re: Blog post !
It's me or you are little bit rough, it's probably me ...STARGÅTE wrote:Just because a C-compiler is used in the backend does not mean that the C-syntax is adopted into PB! Of course not!
All items you listed are feature request for the PureBasic syntax but they are not directly correlated to the compiler backend change.
I'm aware that the C syntax will not be adopted directly into PureBasic. That being said it should be fairly easy to make the feature request I have listed into the PureBasic syntax because GCC already know how to deal with that stuff.
Anyway, the question I have asked was meant to be answered by Fred and/or Freak only.
Best regards
StarBootics
The Stone Age did not end due to a shortage of stones !
Re: Blog post !
I think it was just emphasis, I don't think he was being rough
Re: Blog post !
Very interested in the answer to an important question.
It is especially important for the linux ecosystem.
Will it be possible to outsource the generated C source to be built with gcc without purebasic?
p.s. I mean the ability to generate standalone deb-src (rpms)
It is especially important for the linux ecosystem.
Will it be possible to outsource the generated C source to be built with gcc without purebasic?
p.s. I mean the ability to generate standalone deb-src (rpms)
Dawn will come inevitably.
-
- Enthusiast
- Posts: 269
- Joined: Thu Dec 17, 2009 12:00 pm
- Location: Llangadog, Wales, UK
- Contact:
Re: Blog post !
Wow! - this is a busy thread Thought I might join the party with my simple response :
Exciting stuff but very happy to wait until Fred and the team have done their magic. The current PureBasic is already great as it is - if a new back-end helps with future versions and platforms then that's fantastic.
+1 ... that will do nicely for meJosh wrote:Stay cool and wait and see. The first goal should be that Pb under C runs as stable as it does now with the current language set.
Exciting stuff but very happy to wait until Fred and the team have done their magic. The current PureBasic is already great as it is - if a new back-end helps with future versions and platforms then that's fantastic.
... Exactly!!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
Re: Blog post !
I will relax while being excited
Re: Blog post !
Hi folks,
as written before: I love reading this thread. It just shows how active this community is -- and that we care what happens to PB.
I think the first goal is to get an almost equal exchange of the compiler. If that's all okay, there will (maybe) be improvements in any direction. But we all don't know that. As the discussion shows, the ideas about improvements are also far apart.
Let's see which of the various ideas will find favor with the development team.
In any case, i'm relaxed and looking forward to testing the first beta.
Happy Coding and stay healthy.
as written before: I love reading this thread. It just shows how active this community is -- and that we care what happens to PB.
I think the first goal is to get an almost equal exchange of the compiler. If that's all okay, there will (maybe) be improvements in any direction. But we all don't know that. As the discussion shows, the ideas about improvements are also far apart.
Let's see which of the various ideas will find favor with the development team.
In any case, i'm relaxed and looking forward to testing the first beta.
Happy Coding and stay healthy.
Mostly running PureBasic <latest stable version and current alpha/beta> (x64) on Windows 11 Home