Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Loezi
Dec 18, 2012

Never buy the cheap stuff

Pollyanna posted:

Why is it a string?

Why? For the Glory of Satan of course!

Adbot
ADBOT LOVES YOU

CPColin
Sep 9, 2003

Big ol' smile.
Thankfully, being C, it's still an array of bytes!

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe

Munkeymon posted:

Assuming you're getting it on one of the big email services, you should really report it as spam because it'll hurt their score on the filters and they won't take their lovely compliance seriously until people who actually want their daily whatevers don't get them.

This is how I handle all unwanted email. "Oh, you've opted me into whatever stupid newsletter you decided to add to your site? Great, it's spam now. Maybe I'll let Google try to unsubscribe me but that's the most effort I'm willing to put into interacting with your POS customer relations team."

Pollyanna
Mar 5, 2005

Milk's on them.


CPColin posted:

Thankfully, being C, it's still an array of bytes!

Hahahaha I love the idea of their unit test for exporting an array of bytes to be some sort of data quine.

Kazinsal
Dec 13, 2011


iospace posted:

C is the best :colbert:

NO I DO NOT HAVE STOCKHOLM SYNDROME THANKS FOR ASKING

Same. I will move to Rust or Go or whatever the latest fad in systems programming languages is when someone writes one that I can actually do low-level systems programming with. Maybe.

CPColin posted:

Thankfully, being C, it's still an array of bytes!

yesssssssssss

iospace
Jan 19, 2038


Kazinsal posted:

Same. I will move to Rust or Go or whatever the latest fad in systems programming languages is when someone writes one that I can actually do low-level systems programming with. Maybe.

Yeah, I'm a low-level person myself. The only other realistic option at this juncture is assembly and

FUUUUUUUUUUCK
THAT

Zaphod42
Sep 13, 2012

If there's anything more important than my ego around, I want it caught and shot now.
Assembly is an awesome cool language... as long as I never *have* to use it and only mess with it when I'm in the mood.

gently caress actually writing anything big in assembly. Hell no.

I think Rollercoaster Tycoon was entirely programmed by one guy IN ASSEMBLY, which is straight up bonkers.

Pollyanna
Mar 5, 2005

Milk's on them.


Assembly was kinda fun in human resource machine.

zergstain
Dec 15, 2005

iospace posted:

Yeah, I'm a low-level person myself. The only other realistic option at this juncture is assembly and

FUUUUUUUUUUCK
THAT

C++? With poo poo like RTTI disabled of course.

Volguus
Mar 3, 2009

zergstain posted:

C++? With poo poo like RTTI disabled of course.

Unless you have a very good reason to disable RTTI and you know what you're doing ... don't.

zergstain
Dec 15, 2005

Volguus posted:

Unless you have a very good reason to disable RTTI and you know what you're doing ... don't.

Mostly I was thinking for low level systems programming you would want to minimize runtime overhead. I mainly had Apple's IOKit in mind.

nielsm
Jun 1, 2009



zergstain posted:

Mostly I was thinking for low level systems programming you would want to minimize runtime overhead. I mainly had Apple's IOKit in mind.

As far as I know, C++ RTTI only has runtime cost when you perform dynamic casts. It also has a cost in static data and generated support code, which is negligible for big systems, but could be an issue for embedded where storage is measured in kilobytes.

FoiledAgain
May 6, 2007

Zaphod42 posted:

I think Rollercoaster Tycoon was entirely programmed by one guy IN ASSEMBLY, which is straight up bonkers.

Apparently, only 99% was written in machine code. What a slacker.

Jewel
May 2, 2009

Yet it seems like it was the last foray he did, sticking to what he knew. I work with a coworker who made some Commodore 64 games I enjoy, and it's really shocking thinking about how he's somehow progressed into the 21st century AAA development seamlessly. I can't imagine how weird the progression would have been working in the industry from assembly only with no debuggers to full ides and sdks along with all the tricks of engine development and spiralling game sizes.

Dylan16807
May 12, 2010

Kazinsal posted:

Same. I will move to Rust or Go or whatever the latest fad in systems programming languages is when someone writes one that I can actually do low-level systems programming with. Maybe.


yesssssssssss
I think Rust can do that? I'd give the language some more time to settle, but it's an explicit design goal.

Of course it requires that you can compile with LLVM and not just some bespoke trash C compiler.

JawnV6
Jul 4, 2004

So hot ...

nielsm posted:

embedded where storage is measured in kilobytes.

:allears:

Linear Zoetrope
Nov 28, 2011

A hero must cook

Dylan16807 posted:

I think Rust can do that? I'd give the language some more time to settle, but it's an explicit design goal.

Of course it requires that you can compile with LLVM and not just some bespoke trash C compiler.

Rust has no std-lib features and direct memory fiddling capabilities. Somebody has written a toy, I believe self-hosting OS in Rust with some significant features like device and graphics interfaces (including a port of libmesa), and networking.

I wouldn't like... use it for anything that you need to be cock sure is perfect atm, but you can do pretty deep low level stuff. (Especially crypto, nothing related to crypto in Rust has been verified by an expert, so if you need any crypto functionality you're boned without involving a C toolchain at some point).

SupSuper
Apr 8, 2009

At the Heart of the city is an Alien horror, so vile and so powerful that not even death can claim it.

Pollyanna posted:

Why is it a string?
You'd be surprised how many programmers don't understand bytes.

Similarly, I've seen code store a set of booleans as "101101101" (a string).

LongSack
Jan 17, 2003

SupSuper posted:

You'd be surprised how many programmers don't understand bytes.

Similarly, I've seen code store a set of booleans as "101101101" (a string).

PL/I flashbacks ...

Coffee Mugshot
Jun 26, 2010

by Lowtax
I also don't understand the gripe against Rust for low-level systems programming. I'm not doubting it, just asking for a more obvious example. It's not obvious to me.

JawnV6
Jul 4, 2004

So hot ...
Here’s my favorite Rust take: http://notes.willcrichton.net/rust-the-new-llvm/

iospace
Jan 19, 2038


SupSuper posted:

You'd be surprised how many programmers don't understand bytes.

Similarly, I've seen code store a set of booleans as "101101101" (a string).

What.

No really, what.

BITWISE OPERATIONS MOTHER FUCKER, DO YOU KNOW THEM

Rubellavator
Aug 16, 2007

SupSuper posted:

You'd be surprised how many programmers don't understand bytes.

Similarly, I've seen code store a set of booleans as "101101101" (a string).

We often represent byte arrays as base64 strings, and I've dealt way too many times with someone calling .getBytes() directly on that string without decoding.

VikingofRock
Aug 24, 2008




The biggest complaint I usually hear about low-level Rust is that there's no support for custom allocators. I don't really do enough low-level stuff to know how big of a deal that is, though.

iospace
Jan 19, 2038


Coffee Mugshot posted:

I also don't understand the gripe against Rust for low-level systems programming. I'm not doubting it, just asking for a more obvious example. It's not obvious to me.

I've never personally used it or have had a need to use it, so I'm effectively neutral on it. So until someone proves that it's usable without having to write 9001 custom libraries for what I want, then C it is.

(If someone has an Atmel library writen in it, I may try it for shits 'n giggles)

Linear Zoetrope
Nov 28, 2011

A hero must cook

VikingofRock posted:

The biggest complaint I usually hear about low-level Rust is that there's no support for custom allocators. I don't really do enough low-level stuff to know how big of a deal that is, though.

There is but it's unstable, no idea how much of a PITA it is to use though.

comedyblissoption
Mar 15, 2006

Linear Zoetrope posted:

Rust has no std-lib features and direct memory fiddling capabilities.
What are the "direct memory fiddling capabilities" that Rust doesn't have? As far as I'm aware you can write and read arbitrary bytes in Rust.

Linear Zoetrope
Nov 28, 2011

A hero must cook

comedyblissoption posted:

What are the "direct memory fiddling capabilities" that Rust doesn't have? As far as I'm aware you can write and read arbitrary bytes in Rust.

Sorry, that was meant to read "no std lib" features and "direct memory fiddling capabilities". As in, it has features to eschew using the standard library. I just phrased it dumb.

b0lt
Apr 29, 2005

Coffee Mugshot posted:

I also don't understand the gripe against Rust for low-level systems programming. I'm not doubting it, just asking for a more obvious example. It's not obvious to me.

This is a bit esoteric, but you can't implement libc with it because rust doesn't support functions with variadic arguments.

repiv
Aug 13, 2009

Linear Zoetrope posted:

There is but it's unstable, no idea how much of a PITA it is to use though.

There's also an approved RFC for per-container allocators: https://github.com/rust-lang/rfcs/blob/master/text/1398-kinds-of-allocators.md

It's not fully implemented yet but they're getting there.

Coffee Mugshot
Jun 26, 2010

by Lowtax

b0lt posted:

This is a bit esoteric, but you can't implement libc with it because rust doesn't support functions with variadic arguments.

That's fair, but I sort of assumed any low level systems programming would involve linking against libc and calling it through some FFI or w/e. I don't think re-implementing libc would be a goal. It just seems pretty nice to know a few kernel modules are memory safe/sanitized or something. I guess when I think of the overall need for things like https://github.com/google/sanitizers, it seems like what Rust offers would offset the need for explicit sanitation passes in the compiler (I guess you'd still want TSan).

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

b0lt posted:

This is a bit esoteric, but you can't implement libc with it because rust doesn't support functions with variadic arguments.

In my ignorance I always thought variadic functions were just syntactic sugar for passing in array arguments. I'm guessing that isn't the case at all in C?

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
nah, you just get extra arguments pushed to the stack. va_list just walks the stack for you. it's a ridiculous idea and can go incredibly wrong.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.




That's... well that sure is a take

iospace
Jan 19, 2038



Can I, uh, get a tl;dr here? Because aren't Rust and LLVM two entirely different things?

PhantomOfTheCopier
Aug 13, 2008

Pikabooze!

iospace posted:

Because aren't Rust and LLVM two entirely different things?
But it's a new language, hence it automatically is better than * and subsumes * and what are these other things of which you speak the world started with Rust.

Besides, Rust==LLVM because their Levenshtein distance is equal to their string lengths. :razz:

eth0.n
Jun 1, 2012

iospace posted:

Can I, uh, get a tl;dr here? Because aren't Rust and LLVM two entirely different things?

LLVM provides a cross-platform assembly-ish language that frontend compilers (such as Rust's) can target, which can then be compiled into actual assembly for target platforms. This is advantageous because a wide variety of languages can be implemented without having to reimplement things like register allocation and optimizations.

The article suggests that Rust itself is an even better intermediate language, because it can provide zero runtime cost vs LLVM, but offer a great many compile-time capabilities, such as type-checking and memory/concurrency safety guarantees.

iospace
Jan 19, 2038


PhantomOfTheCopier posted:

But it's a new language, hence it automatically is better than * and subsumes * and what are these other things of which you speak the world started with Rust.

Besides, Rust==LLVM because their Levenshtein distance is equal to their string lengths. :razz:

So in otherwords, the same type of people you see thumping functional languages all the time. Got it.

eth0.n posted:

LLVM provides a cross-platform assembly-ish language that frontend compilers (such as Rust's) can target, which can then be compiled into actual assembly for target platforms. This is advantageous because a wide variety of languages can be implemented without having to reimplement things like register allocation and optimizations.

The article suggests that Rust itself is an even better intermediate language, because it can provide zero runtime cost vs LLVM, but offer a great many compile-time capabilities, such as type-checking and memory/concurrency safety guarantees.

Ah, ok. So compiler stuff that generally wooshes over my head.

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

eth0.n posted:

LLVM provides a cross-platform assembly-ish language that frontend compilers (such as Rust's) can target, which can then be compiled into actual assembly for target platforms. This is advantageous because a wide variety of languages can be implemented without having to reimplement things like register allocation and optimizations.

The article suggests that Rust itself is an even better intermediate language, because it can provide zero runtime cost vs LLVM, but offer a great many compile-time capabilities, such as type-checking and memory/concurrency safety guarantees.

Considering that Rust's biggest advantage over LLVM (or C, or C--) lies in its compile-time checks, it seems odd to choose it as a compilation target.

That is, you could write a compiler for your language that is smart enough to write Rust code that successfully compiles, but it sounds like it would be relatively easier to just do the same compile-time checks in your compiler and then compile to a target that lacks those checks.

Although, if you make a mistake, having your compiler emit Rust code that doesn't compile at all might be preferrable to having your compiler emit buggy C / LLVM code, I guess.

In any case, I can't say if that's an accurate interpretation of what the article means, because my work firewall is awesome:

Adbot
ADBOT LOVES YOU

Coffee Mugshot
Jun 26, 2010

by Lowtax
I mean, the idea is reasonable. I assume you would write a huge standard library for your language in Rust and then just have your compilation frontend generate some intermediate code that calls those library functions after you take all the expressions in your languages and massage them into Rust code. The generated code would probably be very little in comparison to the size of the existing Rust stdlib that people can actually read and write and use nice tools for. Debugging Rust code would probably be a lot easier than debugging LLVM IR's SSA code in terms of the tooling in place. And well, Rust generates LLVM IR anyways. It seems like it'd be nice not to reimplement the borrow checking logic in your language if you take advantage of an intermediary target that becomes LLVM IR anyways.

If I was writing a new "memory-safe" language, this could be an easier start than actually using LLVM.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply