News for hackers. Stuff that matters.
Re:Why is Rust difficult? by blattimwind on Monday January 22, 2018 @03:46AM (#16202894)
> Only if talking about microcontrolers with few hundred KB, where even C is a challenge.

C is the default and not a challenge on 8-bitters.

Re:Why is Rust difficult? by pjmlp on Monday January 22, 2018 @03:58AM (#16202942)
So which compiler does offer 100% ANSI C compliance on something like a Z80 or PIC?
Re:Why is Rust difficult? by flohofwoe on Monday January 22, 2018 @04:30AM (#16203080)
SDCC is standard compliant (even up to C11) and has support for Z80: http://sdcc.sourceforge.net/
Re:Why is Rust difficult? by pjmlp on Monday January 22, 2018 @04:41AM (#16203138)
Thanks for pointing it out, I wasn't aware of it and it does look good, but they clearly state the uses cases which it isn't fully ANSI C compliant on page 24 of the documentation.
Re:Why is Rust difficult? by vardump on Monday January 22, 2018 @06:28AM (#16203550)
I think you're nitpicking.

That's close enough in my book. Those MCUs are tricky targets and I can certainly live for example with not being able to pass structs as return values. Or without re-entrancy. Perfectly understandable once you take into account limited IRAM space, 128 or 256 bytes, where stack, register banks and most of your temporaries and globals need to reside.

Re:Why is Rust difficult? by pjmlp on Monday January 22, 2018 @07:03AM (#16203746)
Which validates my point of using C on 8 bit CPUs being a challenge.
Re:Why is Rust difficult? by AnimalMuppet on Monday January 22, 2018 @01:22PM (#16206570)
"Less than absolutely total standard compliance" != "a significant challenge compared to absolutely total standard compliance", especially if the differences are clearly documented.
Re:Why is Rust difficult? by pjmlp on Monday January 22, 2018 @02:01PM (#16206928)
The challenge is not being able to write idiomatic ANSI C, rather trying to tame the compiler to produce code comparable to hand tuned Assembly to fit into those processors, the majority of time using compiler specific extensions.
Re:Why is Rust difficult? by AnimalMuppet on Monday January 22, 2018 @04:33PM (#16208113)
You're sounding like a propagandist - like you want to just argue your talking points, rather than actually have a conversation where you listen to what the other side is actually saying. It makes you a real pain to talk to.

Just in case you're actually trying to engage in good faith, though, I'll try this one more time. If I have a compiler that is less-than-100% standards compliant, I may not be able to use a few features of the standard. That means there may be a few ANSI C idioms that I can't use. Of those, the number that I would choose to use on that size of processor is very, very few. So in practice, there is no "challenge".

Why would I use very few of these features? Because on a processor that size, you're not writing a huge app. You don't use all the functions in the standard library, you don't use all the keywords, you usually don't push the language very far at all. At worst, you might have to develop one or two idioms of your own. It's... mildly annoying, rather than the big deal you're trying to make it.

Re:Why is Rust difficult? by wott on Monday January 22, 2018 @10:49AM (#16205247)
It is not a challenge, it is by far the most common way to program them.
Re:Why is Rust difficult? by pjmlp on Monday January 22, 2018 @02:02PM (#16206936)
Yeah not being able to write idiomatic ANSI C, rather trying to convince the compiler to produce code comparable to hand tuned Assembly to fit into those processors, the majority of time using compiler specific extensions.
Re:Why is Rust difficult? by lukaslalinsky on Monday January 22, 2018 @08:05AM (#16204039)
SDCC is also full of bugs and the compiled code is not well optimized. For a low level CPU like that, you have to write assembly at some point.
Re:Why is Rust difficult? by flohofwoe on Monday January 22, 2018 @08:41AM (#16204222)
I wrote smaller programs with it for a Z80 home computer which originally didn't have C support. I didn't encounter bugs, but it's true that the code generation is less than optimal for Z80 when compared to manually written assembly (understandable because of the small register set), but the compiler supports mixing assembly and C very well, so no complains here :)
Re:Why is Rust difficult? by blattimwind on Monday January 22, 2018 @11:59AM (#16205881)
Literally the whole industry doesn't care two bits about "100% ANSI C compliance", which I'd guess isn't even possible on a pure Harvard architecture like AVR or PIC.