6 ms·
GCC now includes Modula-2 and Rust. Do they work on OpenBSD?
- doomrobo 4y agoMy guess is println! wasn't defined because the std crate isn't supported for the OpenBSD target yet
- saghm 4y agoFrom looking at the supported platforms, the standard library seems to work for most OpenBSD targets, but they don't provide official builds (presumably due to not having anyone volunteering to maintain dedicated hardware for them to use for CI); the Tier 3 platforms[1] list OpenBSD on x86_64, i686, aarch64, sparc64, powerpc64, and riscv64gc as all having the standard library functioning. Due to there not being official builds, I'm guessing that there would either have to be an officially maintained package to install or you'd have to build it from scratch, though, but it seems likely that having a functioning compiler already means that you wouldn't have to fully bootstrap everything (and if you did, maybe it would be possible to bootstrap from rustc?) [1]: https://doc.rust-lang.org/nightly/rustc/platform-support.html#tier-3 https://doc.rust-lang.org/nightly/rustc/platform-support.htm...
- nevi-me 4y agoI think the simpler answer is that regardless of platform, gccrs can't yet compile core or std libraries, so println! won't work (https://github.com/Rust-GCC/gccrs/issues/1389 https://github.com/Rust-GCC/gccrs/issues/1389). I don't think it's about what tier is supported in rustc, as that's compiled by LLVM in that case.
- saghm 4y agoAh okay, that makes sense. Sorry for my confusion!
- chungy 4y agoSeems a nice way to bury a lede :) No links back to GCC including the languages, and a look at https://gcc.gnu.org/ https://gcc.gnu.org/ doesn't reveal it either, even if you click on changes for GCC 13.
- bentt 4y agoModula-2! Now that’s a name I’ve not heard in a long time. A long time.
- SoftTalker 4y agoIndeed. Used it for one semester in my undergrad CS program.
- glonq 4y agoUgh; one of our profs had spent some years in Switzerland working on control systems for tunnels or something like that, and made modula-2 mandatory for our data comm course even though students were proficient in C/C++ at this point and preferred it.
- anonymousiam 4y agoVery cool. Pascal can be compiled with GCC by feeding it through the p2c front end. Obviously this isn't native support, but it's something! http://users.fred.net/tds/lab/p2c/ http://users.fred.net/tds/lab/p2c/ and more here: http://www.garret.ru/ptoc/Readme.htm http://www.garret.ru/ptoc/Readme.htm http://freesourcecode.net/cprojects/94701/Pascal-to-c-converter http://freesourcecode.net/cprojects/94701/Pascal-to-c-conver... https://web.archive.org/web/20060426224216/http://directory.fsf.org/GNU/p2c.html/ https://web.archive.org/web/20060426224216/http://directory....
- scrame 4y agoThis is the first I've heard of Objective-C++ [1]. What kind of masochist would you have to be to pick that? [1] https://en.wikipedia.org/wiki/Objective-C#Objective-C++ https://en.wikipedia.org/wiki/Objective-C#Objective-C++
- arcticbull 4y agoObjective-C is a superset of C, and Objective-C++ extends that to C++. It's really only meant as a shim layer to bridge C++ libraries with Objective-C. Or at least, that was the case in the pre-Swift days.
- fathyb 4y agoI did, mostly for Metal-based rendering. It's great if you want to mix Apple's Objective-C APIs with your own C++ code.
- pjmlp 4y agoWhich is a much better solution than using the incomplete C++ bindings released earlier this year.
- jxy 4y agothis? https://developer.apple.com/metal/cpp/ https://developer.apple.com/metal/cpp/ Doesn't it just use objc/runtime.h and if anything is missing you can just add your custom api calls?
- pjmlp 4y agoThat is exactly it, the additional effort to add missing calls, no Metal frameworks integration, it is mostly for basic workloads.
- jaas 4y agoThe OS X platform code for Firefox is written in Objective-C++. It's not without issues, but overall it's a nice way to use Objective-C from within a larger C++ code base. I didn't find it difficult to work with, particularly as opposed to what we'd have to do if Objective-C++ didn't exist. If you want to see what this looks like, look at the .mm files here: https://github.com/mozilla/gecko-dev/tree/master/widget/cocoa https://github.com/mozilla/gecko-dev/tree/master/widget/coco... If you want a specific file to look at with good examples of how this works, here's one: https://github.com/mozilla/gecko-dev/blob/master/widget/cocoa/nsChildView.mm https://github.com/mozilla/gecko-dev/blob/master/widget/coco... Basically what you're looking for is being able to make Obj-C calls (e.g. [[ChildView alloc] initWithFrame:r geckoChild:this]) from within what is otherwise normal C++, and vice-versa.
- oytis 4y agoWonder who had enough motivation and time for Modula-2 work.
- kmoser 4y agoIt was definitely Wirth the effort.
- whartung 4y agoI’m not familiar enough with the GCC stack. I’m curious how much effort was necessary for the M2 front end developer to concentrate on efficiency and optimization in contrast to writing something straightforward and having GCC optimize the intermediate form. I’m sure both components have some responsibility, just curious how much the intermediate form gives the compiler author “for free”.
- kristianp 4y agoWhy add support for a rarely used old language like Modula-2?
- wtetzner 4y agoI assume someone wanted it, and was willing to put in the effort.
- hobofan 4y agoBy adding it to upstream GCC, I assume that it incurs some maintenance burden. So I think the more interesting question would be "Why would upstream GCC merge support for Modula-2, and with that accept some work and risk for little reward?".
- kristianp 4y agoWhy add support for a rarely used old language like Modula-2? (I'm not going to call it "mostly dead" though [1]). [1] https://news.ycombinator.com/item?id=34040397 https://news.ycombinator.com/item?id=34040397
- Mikeb85 4y agoBecause someone wanted to and did the work.
- locusofself 4y agoStupid question, but doesn't rust have it's own, highly praised compiler? I'm just genuinely curious - would using gcc be better under any practical circumstance? Do they both generate low level code with/for LLVM?
- kramerger 4y agoActually, if they can provide a stable release with the most important nightly features I might pick this over rustc. The rust team don't seem to understand anything about production software, quality assurance and maintenance. Hopefully competing with a more organised compiler with TLS support that is not crippled will put some pressure on them.
- rob74 4y agoRust-GCC has an FAQ section that lists the benefits of having a GCC frontend: https://github.com/Rust-GCC/gccrs/wiki/Frequently-Asked-Questions#benefits https://github.com/Rust-GCC/gccrs/wiki/Frequently-Asked-Ques... I'm in no way a compiler expert, but from what I understood, they specifically want to avoid mixing GCC and LLVM: https://github.com/Rust-GCC/gccrs/wiki/Frequently-Asked-Questions#why-was-adding-gcc-backend-for-rustc----rejected https://github.com/Rust-GCC/gccrs/wiki/Frequently-Asked-Ques...
- mlindner 4y agoYou can also use rustc as a frontend to GCC through rustc_codegen_gcc. https://github.com/rust-lang/rustc_codegen_gcc https://github.com/rust-lang/rustc_codegen_gcc
- PeterStuer 4y agoWhen I was a CS undergrad the first language studied was Modula 2. I still think of it as a great simple language to introduce people to programming.