Old account at https://lemmy.ml/u/qaz
I just tested it and a simple hello world program still produces a 1.7MiB binary, while the device only has 512KiB of RAM.
package main
import "fmt"
func main() {
fmt.Println("hello world")
}
I would love to use golang for this but it’s standard library alone is bigger than the amount of available RAM.
I didn’t use -Werror
but no warning about it showed up either. The project uses a semi-custom toolchain for a microcontroller, but I’m not using it to compile this code. I have another file with an entrypoint which tests some classes to be used by the microcontroller. The EEPROM in the code example is actually a macro for a class I’ve written that emulates the EEPROM library by writing and reading to a file on disk.
It’s a bit of a mess but this dual toolchain setup seemed easier than emulating the board and peripherals in it’s entirety. I might have to retry that though using Wokwi.
It’s on the company computer, but I have a backup from earlier today that seems to have the same code.
bool load_metadata() {
uint8_t marker_field = EEPROM.read(0);
// Write to ROM if marker has not been set
if (marker_field != MARKER) {
metadata = {
0,
};
EEPROM.put(1, metadata);
EEPROM.update(0, MARKER);
}
else {
EEPROM.get(1, metadata);
}
}
I have to admit, my experience with C++ is rather limited, last Monday was the first time in my life that I used a C++ compiler. I had some issues getting it to work with Visual Studio, so I ended up using VS Code WSL with clang 😅.
It’s C++ and it just causes a SIGILL.
I spent 3 hours debugging the serialization code to find out it the crash was because the function didn’t have a return statement.
I separate everything in virtual environments myself, but in my opinion you shouldn’t need to that to simply avoid breaking your system.
Clang won’t tell you if you’re missing a return statement, even with all warnings on and will just let it crash during runtime. Static analysis won’t save you from all stupid mistakes.
You’ve never had broken dependencies?
I agree that it’s silly to package your app as a website with a browser but what other options do you have? GTK is difficult to get working on Windows, wxwidgets requires installing libraries on every system and Qt is either paid or LGPL. The only real crossplatform options seem to be Flutter and some .NET frameworks.
They probably manually added the patch.
Last time I checked the version Electron used by Discord was severely out of date causing several issues that had been solved months ago upstream. That’s the fault of Discord, not Electron but there are several issues with Chromium that I have to deal with on every Electron app I use. Compose sequences are still partially broken. I reported it at Chromium but they responded with a video of them testing it on Windows (not with a VM), said they couldn’t reproduce the issue (with a Linux specific input method?!) and then marked it as unreproducible.
I used COBOL to write a small program, and it’s not so bad either. Bonus is that your standards are lowered so much that Java feels concise.
if ok {
return true
} else {
return false
}
Why?
Every syntax highligher shows this and VSCode even has a special case for this, this is not a real issue.
Thanks, I’ve tried it and it works a lot better than the built in intelli-sense.