[SOLVED]Postfix and Prefix operator

ApacheKid

Joined Jan 12, 2015
1,610
And it does so in a very platform-specific way. Whereas C compiles to basically ANY kind of machine code.

Having said that, yes, assembler is a tool too. And if you want or have to implement something using that particular tool, that is fine. (Regarding that, I prefer the INTEL syntax over AT&T.)

I also do not agree that C is broken. In fact I am so confident of that, if something goes wrong in my code, I automatically know that it is my own fault. On the other hand, there are a lot of languages are truly "broken". (Did you know that no Java implementation can handle a function body consisting of more than 2^16 bytes? It's kludgy "generics" objects don't actually work very well either.)
Perhaps terms like 'broken' and 'own fault' aren't helpful. C's adequate when used cautiously, but it does require considerable cognitive effort by the programmer. Optional tools like linters and so on are evidence too that C is inadequate, the constructs we strive to avoid could, should be prevented by the language itself, it should be hard to access illegal array elements, hard to write code that produces different outputs on different targets, easy to manipulate strings, easy to deal with exceptions, hard to overwrite memory and so on, but C makes it easy, too easy.

IMHO, as an experienced compiler developer with huge experience of C, a language that makes these things easy, almost inevitable, is not well designed.
 

nsaspook

Joined Aug 27, 2009
13,272
Perhaps terms like 'broken' and 'own fault' aren't helpful. C's adequate when used cautiously, but it does require considerable cognitive effort by the programmer. Optional tools like linters and so on are evidence too that C is inadequate, the constructs we strive to avoid could, should be prevented by the language itself, it should be hard to access illegal array elements, hard to write code that produces different outputs on different targets, easy to manipulate strings, easy to deal with exceptions, hard to overwrite memory and so on, but C makes it easy, too easy.

IMHO, as an experienced compiler developer with huge experience of C, a language that makes these things easy, almost inevitable, is not well designed.
The problem is there are applications like in deeply embedded low-level programming where many of the bad things C (it's loosely designed intentionally to make machine dependent outputs, etc.. possible because you need that on bare metal hardware) does on the user application level are necessity to avoid assembly language specific constructs which IMO would be even worse than C. The obvious solution is not to bash C as a blight on all programming, it's to use C when that type of programming is needed. IMO an language like Rust is a good compromise of both styles.
 

ApacheKid

Joined Jan 12, 2015
1,610
The problem is there are applications like in deeply embedded low-level programming where many of the bad things C (it's loosely designed intentionally to make machine dependent outputs, etc.. possible because you need that on bare metal hardware) does on the user application level are necessity to avoid assembly language specific constructs which IMO would be even worse than C. The obvious solution is not to bash C as a blight on all programming, it's to use C when that type of programming is needed. IMO an language like Rust is a good compromise of both styles.
What does C provide then? what exactly are these strong points that might be "worse" in some other language, are you arguing that C cannot ever be improved? a better language can never be designed? If one wanted to design a better language than C for these 'bare metal' projects, one would be unable to?
 
Last edited:

ApacheKid

Joined Jan 12, 2015
1,610
My own position is that a language that would be good for MCU development, must be suitable for writing a real, serious operating system. If it can do that well then it's a contender, why? because MCU work often entails having some OS like functions, perhaps a rudimentary scheduler or protected mode components.

So yes, C satisfies that requirement but so too would PL/I Subset G for example and there are potentially others. So that's my guiding light, can a new language be used to write an OS.
 

panic mode

Joined Oct 10, 2011
2,749
i can sympathize with all that are learning to tip-toe around its many quirks. and yes, it is an ugly language... with a massive prefix F before the 'ugly'.
 

panic mode

Joined Oct 10, 2011
2,749
everything that was asked by TS (prefix and postfix) is already answered multiple times, for example posts 2 and 14 just to name some.
 
Top