Page 2 of 5
Re: PB vs C
Posted: Tue Sep 24, 2024 1:54 pm
by TI-994A
Fred wrote: Tue Sep 24, 2024 1:35 pm...ternary are meant to be used in an expression: a = b <> 0 ? 11 : 42
...it can also be nested.
Precisely. Plus, there is a certain elegance in the syntax.
Code: Select all
Define a, c = #True
!v_a = (v_c) ? ((v_a == 0) ? (789 - 9) : 123) : (v_a == 123) ? (456 + 4) : (456 - 6);
Debug a
Re: PB vs C
Posted: Tue Sep 24, 2024 1:57 pm
by Kiffi
TI-994A wrote: Tue Sep 24, 2024 1:54 pm
Precisely. Plus, there is a certain elegance in the syntax.
Code: Select all
Define a, c = #True
!v_a = (v_c) ? ((v_a == 0) ? (789 - 9) : 123) : (v_a == 123) ? (456 + 4) : (456 - 6);
Debug a
You call it elegant, I call it unmaintainable.

Re: PB vs C
Posted: Tue Sep 24, 2024 1:59 pm
by Little John
Kiffi wrote: Tue Sep 24, 2024 1:57 pm
You call it elegant, I call it unmaintainable.
That's how I call it, too.
Re: PB vs C
Posted: Tue Sep 24, 2024 2:12 pm
by TI-994A
Little John wrote: Tue Sep 24, 2024 1:59 pm
Kiffi wrote: Tue Sep 24, 2024 1:57 pm
TI-994A wrote: Tue Sep 24, 2024 1:54 pm
Precisely. Plus, there is a certain elegance in the syntax.
Code: Select all
Define a, c = #True
!v_a = (v_c) ? ((v_a == 0) ? (789 - 9) : 123) : (v_a == 123) ? (456 + 4) : (456 - 6);
Debug a
You call it elegant, I call it unmaintainable.
That's how I call it, too.
Here's the PureBasic version:
Code: Select all
Define a, c = #True
If c
If a = 0
a = 789 - 9
Else
a = 123
EndIf
ElseIf a = 123
a = 456 + 4
Else
a = 456 - 6
EndIf
Debug a
The ternary is a far superior operator and is an acquired taste;
once you know how to use it. 
Re: PB vs C
Posted: Tue Sep 24, 2024 2:20 pm
by Little John
If I would like hard readabe soure code, I would use e.g. Perl rather than PureBasic.
Re: PB vs C
Posted: Tue Sep 24, 2024 2:24 pm
by Fred
TI-994A wrote: Tue Sep 24, 2024 2:12 pm
Little John wrote: Tue Sep 24, 2024 1:59 pm
Kiffi wrote: Tue Sep 24, 2024 1:57 pm
TI-994A wrote: Tue Sep 24, 2024 1:54 pm
Precisely. Plus, there is a certain elegance in the syntax.
Code: Select all
Define a, c = #True
!v_a = (v_c) ? ((v_a == 0) ? (789 - 9) : 123) : (v_a == 123) ? (456 + 4) : (456 - 6);
Debug a
You call it elegant, I call it unmaintainable.
That's how I call it, too.
Here's the PureBasic version:
Code: Select all
Define a, c = #True
If c
If a = 0
a = 789 - 9
Else
a = 123
EndIf
ElseIf a = 123
a = 456 + 4
Else
a = 456 - 6
EndIf
Debug a
The ternary is a far superior operator and is an acquired taste;
once you know how to use it.
Nested ternary is smaller to write, but it's really hard to follow, you proved my point

Re: PB vs C
Posted: Tue Sep 24, 2024 2:50 pm
by TI-994A
Fred wrote: Tue Sep 24, 2024 2:24 pmNested ternary is smaller to write, but it's really hard to follow, you proved my point
You're right; the ternary operator might prove a little daunting to the uninitiated,
clearly.
Nevertheless, it's
nice to have the choice now that it's available inline.
Re: PB vs C
Posted: Tue Sep 24, 2024 3:21 pm
by skywalk
I'll pass. But then, I also don't like multiline statements with : .
Re: PB vs C
Posted: Tue Sep 24, 2024 6:23 pm
by plouf
this thing with "invention of C" has become very tired.
vast majority, practically ALL here, know how C works and for this reason we choose PB..
because if you look at with search feature you will see hundred of times this has started
i think is a good idea to block these threads automatically...
Re: PB vs C
Posted: Tue Sep 24, 2024 7:43 pm
by threedslider
Why? this forum is an expression of freedom for everyone to express their opinion ...
It is not against to PB, on contrary it is to make PB better in future programming

Re: PB vs C
Posted: Tue Sep 24, 2024 7:46 pm
by plouf
Because as explained.
It has expressed too many times and vast majority of users do not agree with "c -sification" swe prefer basic-ification
Already discussed in past forum threads
Evolve is good but on BASIC steps not C steps
Re: PB vs C
Posted: Tue Sep 24, 2024 8:06 pm
by threedslider
Lol
Basic and C have a common in some programming and you know PB has C backend too as well. If you want 100% Basic so you need to seek a basic compiler with no assembler nor C backend...
I say for PB not becoming to C but adding more stuff as inspiration to C, I seek for PB more powerful more possibility that is all and it is more advantageous for everyone...
Re: PB vs C
Posted: Tue Sep 24, 2024 8:19 pm
by plouf
Lol lol lol
Your "idea" is wrong all geound up to the top from
" c has 32 keyword and easy"
"Both are low level and high level"
Also "no assebly" ?! You clearly have mo idea how compilers work and why they are called compilers....
To many other ideas posted.
You terrible look like repeating google found ideas and common talked by the usual repeated "talkshows" in internet and other channel
I have very kindly told you to use search feature to read numerus times discussed .. no need to repeat
Ps. I expect to see you provide GNU-C forums with ideas from PB , to make it easier

Re: PB vs C
Posted: Tue Sep 24, 2024 8:45 pm
by threedslider
Dude...
As you are Basic-ification, I think you don't know something in C has really 32 keywords only... sorry it is not my fault

... know yourself instead of saying anything ...
I know C and C++ too, stop making no sense as you say about from me

... it is not useful to talk with you, sorry.
Re: PB vs C
Posted: Tue Sep 24, 2024 9:15 pm
by idle
There's no need to degenerate into flame wars guys.
I like pb syntax, it's forgiving and self evident.