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
hackbunny
Jul 22, 2007

I haven't been on SA for years but the person who gave me my previous av as a joke felt guilty for doing so and decided to get me a non-shitty av

Private Speech posted:

is git now written in c++

I don't think he did no

in fact he probably hates a lot of additions to c++11

apropos of nothing, microsoft rewrote their C runtime in C++ years ago

Adbot
ADBOT LOVES YOU

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



Zlodo posted:

he wrote this thing using c++ and qt: https://subsurface-divelog.org/

dont tell ol musky about this :ohdear:

Private Speech
Mar 30, 2011

I HAVE EVEN MORE WORTHLESS BEANIE BABIES IN MY COLLECTION THAN I HAVE WORTHLESS POSTS IN THE BEANIE BABY THREAD YET I STILL HAVE THE TEMERITY TO CRITICIZE OTHERS' COLLECTIONS

IF YOU SEE ME TALKING ABOUT BEANIE BABIES, PLEASE TELL ME TO

EAT. SHIT.


Krankenstyle posted:

dont tell ol musky about this :ohdear:

Private Speech posted:

humm

was it in c++ and qt before 2012 while he was involved?

but I suppose everyones opinion can change

ahh no it didn't, it used to use GTK+ lmao

it was ported over by the guy who took over after him

Zlodo
Nov 25, 2006

hackbunny posted:

clang keeps track of the active member in a union, in c++, and can do it with pretty deeply nested unions and method calls. a stack of nested unions is much better as the internal storage of std::variant than the "obvious" choice of a memory-aligned char array, in no small part thanks to the much better compiler diagnostics you get with unions
and yet, the compiler diagnostics that clang barfs when misusing std::variant are atrocious, not to mention the gazillions of intermediate steps on the stack when using std::visit or the mess you end up with when looking at their content in lldb
(and that's with libc++, an implementation of the std c++ library made for clang)

i use std::variant a lot in my current hobby project and while i like having tagged unions the implementation is clunky

hackbunny
Jul 22, 2007

I haven't been on SA for years but the person who gave me my previous av as a joke felt guilty for doing so and decided to get me a non-shitty av

Zlodo posted:

and yet, the compiler diagnostics that clang barfs when misusing std::variant are atrocious, not to mention the gazillions of intermediate steps on the stack when using std::visit or the mess you end up with when looking at their content in lldb
(and that's with libc++, an implementation of the std c++ library made for clang)

i use std::variant a lot in my current hobby project and while i like having tagged unions the implementation is clunky

I wrote a hobby reimplementation of std::variant once (the diagnostics I talked about? they're useful for implementors, not users) and behind the deceptively simple API it's insanely complex so I'm not surprised - especially not surprised about visit, because it has to perform the equivalent of indexing through a heterogeneous collection, which in c++ can only be done through a recursion-based loop

unfortunately I don't think you can make a general purpose sum type simpler than std::variant without massive updates to the language (like herb sutter's metaclass proposal)

hackbunny fucked around with this message at 00:01 on Feb 23, 2019

Sweeper
Nov 29, 2007
The Joe Buck of Posting
Dinosaur Gum

hackbunny posted:

I wrote a hobby reimplementation of std::variant once (the diagnostics I talked about? they're useful for implementors, not users) and behind the deceptively simple API it's insanely complex so I'm not surprised - especially not surprised about visit, because it has to perform the equivalent of indexing through a heterogeneous collection, which in c++ can only be done through a recursion-based loop

unfortunately I don't think you can make a general purpose sum type simpler than std::variant without massive updates to the language (like herb sutter's metaclass proposal)

you can make a simple variant very easily, but the c++ variant is very complex and handles a ton of crazy stuff (I hope I never see code which passes multiple variants to visit). fairly typical of the stl though

Dijkstracula
Mar 18, 2003

You can't spell 'vector field' without me, Professor!

Zlodo posted:

endianness
in the example above CPUs using different byte orderings are going to show a different correspondance between the bits as viewed as a 32 bit int and as 4 separate bytes

there are other things, like floats not necessarily being encoded using the IEEE 754 standard as c++ doesn't specify it, so type puning a float into one or more ints can give different results depending on the platform
So I'm now trying to find a confirmation that this is indeed not UB in C; if what you're saying is right then it would have to be UB both in C and C++ (as hackbunny seems to confirm).

I uh may have to go retract some PRs :v:

quote:

If the member used to read the contents of a union object is not the same as the member last used to store a value in the object, the appropriate part of the object representation of the value is reinterpreted as an object representation in the new type as described in 6.2.6 (a process sometimes called ‘‘type punning’’). This might be a trap representation.
My reading of this of this hinged on a sufficiently-advanced "reinterpretation" :(

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



pro tip: put bjarne in the garbage, just throw him in there.

JawnV6
Jul 4, 2004

So hot ...

Krankenstyle posted:

why not filter them through approriate interfaces that enforce conversion?

Krankenstyle posted:

please just make a type that can handle the conversion properly what the gently caress? now the burden is on some idiot (me) who has to work with your code instead of the compiler that can tell me to stop trying to use the int as a uint or whatever
do y'all ever wonder where the 10MB+ runtimes that underpin your entire universes... come from?

idk what you think HW *should* look like but loudly denigrating everything that touches it is a pretty bad look

DELETE CASCADE
Oct 25, 2017

i haven't washed my penis since i jerked it to a phtotograph of george w. bush in 2003
hardware should be fast like it is now, but without the garbage interfaces it has now, how hard is that to understand :colbert:

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



JawnV6 posted:

do y'all ever wonder where the 10MB+ runtimes that underpin your entire universes... come from?

idk what you think HW *should* look like but loudly denigrating everything that touches it is a pretty bad look

the compiler can work it out with proper a type system prove me wrong

Arcsech
Aug 5, 2008

Krankenstyle posted:

the compiler can work it out with proper a type system prove me wrong

if your argument is that embedded dev should be using rust, you’ll get no argument from me

but like, that doesn’t mean it’s gonna happen

JawnV6
Jul 4, 2004

So hot ...

Krankenstyle posted:

the compiler can work it out with proper a type system prove me wrong
you don't appear to be standing on a solid understanding of the layer we're discussing and seem content to haughtily piss down from your tower of abstraction, an exercise in frustration for me

i dont think these issues have anything to do with the class of memory access issues that rust is particular about

Lime
Jul 20, 2004

hackbunny posted:

problem is that this will only happen in optimized builds, making unoptimized builds much much slower, which is a really common issue in c++ where small and/or pure functions are considered "overhead-free" but they only are if you compile with optimizations. see quasi-operators like std::move and std::forward

wait i thought move and forward were literally just casts to the same type but with references, how would they ever be anything other than nops

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

Lime posted:

wait i thought move and forward were literally just casts to the same type but with references, how would they ever be anything other than nops

they're actual functions that the compiler actually calls unless the inliner runs. they probably ought to be marked always_inline or the local equivalent but i wouldn't be surprised if they aren't

there was a lot of talk in here about c semantics and compilers but as usual you should all just refer to hackbunny's posts unless you have any further questions

BobHoward
Feb 13, 2012

The only thing white people deserve is a bullet to their empty skull

JawnV6 posted:

you don't appear to be standing on a solid understanding of the layer we're discussing and seem content to haughtily piss down from your tower of abstraction, an exercise in frustration for me

i dont think these issues have anything to do with the class of memory access issues that rust is particular about

i get the impression they don't quite understand how typical it is to pack a bunch of non byte sized, non byte aligned fields in a single hw register, where the register access path often does not even support byte-at-a-time access semantics, much less bit-at-a-time (which the cpu doesn't support anyways)

i do this kind of layout when designing registers all the time. i also often end up writing the software that manipulates them. it's fine. i don't want to chew up enormous amounts of address space and bloat out the read muxes to give every 1 bit field its own 32 bit word. fite me haters

also like someone mentioned above, if you're in any place where there's minimal competence you have some kind of simple source code - csv file, json, custom minilang, whatever - that the hardware engineers write to describe registers, and there's scripts to 'compile' that source to C headers and Verilog source code for use on both sides of the hardware/software divide. maybe documentation files too, or documentation embedded in the C headers

the output of these 'compilers' looks ugly to humans when you dig underneath the surface API, but it's a problem no HLL i'm aware of has ever attempted to address in a clean way, so you sweep all the ugliness into machine generated code and it's all fine

Lime
Jul 20, 2004

rjmccall posted:

they're actual functions that the compiler actually calls unless the inliner runs. they probably ought to be marked always_inline or the local equivalent but i wouldn't be surprised if they aren't

ok wow, tried some stuff in compiler explorer. i had no idea std::move(fart) and static_cast<Fart&&>(fart) (like if you didn't want to include any of the standard library headers, for example) would compile differently, i assumed they were basically language features

Xarn
Jun 26, 2015

Krankenstyle posted:

the compiler can work it out with proper a type system prove me wrong

Maybe you meant to be posting there?

https://forums.somethingawful.com/showthread.php?threadid=3863535

gonadic io
Feb 16, 2011

>>=

Arcsech posted:

if your argument is that embedded dev should be using rust, you’ll get no argument from me

but like, that doesn’t mean it’s gonna happen

One of my lovely projects is embedded in rust! It's okay, certainly not the practical choice right now. Also only works on systems that llvm can gen for.
Does support packing fields into a single register just fine though

JawnV6 posted:


i dont think these issues have anything to do with the class of memory access issues that rust is particular about

Rust isn't only about the lifetimes, it does have a HM functionalish type system with standard enums, adts, pattern matching, first class functions, generics, type classes etc etc

gonadic io fucked around with this message at 10:21 on Feb 23, 2019

Beamed
Nov 26, 2010

Then you have a responsibility that no man has ever faced. You have your fear which could become reality, and you have Godzilla, which is reality.


gonadic io posted:

Rust isn't only about the lifetimes, it does have a HM functionalish type system with standard enums, adts, pattern matching, first class functions, generics, type classes etc etc

To me, it's Rust's type system which is most appealing, and the lifetimes are just a nice touch for performance reasons. But I understand I'm in the minority :v:

gonadic io
Feb 16, 2011

>>=

Beamed posted:

To me, it's Rust's type system which is most appealing, and the lifetimes are just a nice touch for performance reasons. But I understand I'm in the minority :v:

fwiw i completely agree with you. i've considered making my own string type that's a wrapper around Rc<String> that implements Copy as Rc's Clone just because they get in the way when i dgaf

luchadornado
Oct 7, 2004

A boombox is not a toy!

Beamed posted:

To me, it's Rust's type system which is most appealing, and the lifetimes are just a nice touch for performance reasons. But I understand I'm in the minority :v:

i dont think youre in the minority tbh. unfortunately the type system would probably suffer if you removed lifetimes

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

Beamed posted:

To me, it's Rust's type system which is most appealing, and the lifetimes are just a nice touch for performance reasons. But I understand I'm in the minority :v:

Yeah if you could somehow remove the ownership system rust would just be a very well designed pragmatic low level language. It doesn't really have any interesting features beyond the borrow checker.

gonadic io posted:

fwiw i completely agree with you. i've considered making my own string type that's a wrapper around Rc<String> that implements Copy as Rc's Clone just because they get in the way when i dgaf

I've fooled around with the idea of an 'idgaf' library for rust, something that makes it easier to write rust when performance isn't absolutely critical. Honestly thought it would boil down to either just using RC or implementing a GC.

Being able to use GC when you don't care would be great, i'd never use any language but rust ever again.

gonadic io
Feb 16, 2011

>>=

DONT THREAD ON ME posted:

I've fooled around with the idea of an 'idgaf' library for rust, something that makes it easier to write rust when performance isn't absolutely critical. Honestly thought it would boil down to either just using RC or implementing a GC.

Being able to use GC when you don't care would be great, i'd never use any language but rust ever again.

i'd use it. my discord bot has always been really verbose and i've been looking for ways to make the code less poo poo for ages now

Arcsech
Aug 5, 2008

gonadic io posted:

One of my lovely projects is embedded in rust! It's okay, certainly not the practical choice right now. Also only works on systems that llvm can gen for.
Does support packing fields into a single register just fine though

oh yeah I know you can do toy projects in embedded rust just fine

but like, microcontroller vendors ain’t gonna make it a supported toolchain any time soon, and even if they did, it would take another decade (minimum) after that for industry to adopt it at any kind of scale

gonadic io
Feb 16, 2011

>>=
honestly if c++ couldn't gain traction, i doubt rust will. it'll just be C now and forever.

The_Franz
Aug 8, 2003

c++ 20 officially has modules :grovertoot:

akadajet
Sep 14, 2003

The_Franz posted:

c++ 20 officially has modules :grovertoot:

glad to see c++ finally catching up to javascript :smug:

carry on then
Jul 10, 2010

by VideoGames

(and can't post for 10 years!)

hope they botch the rollout less than java did

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

gonadic io posted:

honestly if c++ couldn't gain traction, i doubt rust will. it'll just be C now and forever.

everywhere I look, people are starting to roll back C and go to asm

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde
embedophiles still weren’t enthusiastic about moving from c to c++ last time I checked (late 2017), attitude from the manufacturer was “yes we ship tools for it, but who would use them?”

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

gonadic io posted:

i'd use it. my discord bot has always been really verbose and i've been looking for ways to make the code less poo poo for ages now

i like your style. there seem to be a handful of like-minded yospos rust programmers we should all make something.

let's build the rust gc.

DONT THREAD ON ME fucked around with this message at 00:52 on Feb 24, 2019

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
rust gc idea: dereferencing a GCd pointer type returns a future since a collection pause could cause a dereference operation to block.

gonadic io
Feb 16, 2011

>>=
there is already a bunch of existing gc work in rust, seems like hard work imo.

instead i'm more at the "what if I made a library so I didn't have to type Rc:: every time" level

gonadic io
Feb 16, 2011

>>=
plus just in terms of laziness of programming, gc has very little advantage over rc. sure rc might leak memory if you have cycles, and has a possible bigger runtime cost (although it's more predictable).

Feisty-Cadaver
Jun 1, 2000
The worms crawl in,
The worms crawl out.

hackbunny posted:

I worked in grails for years and I profoundly hate it. nobody should use it

I hope you got paid $400k/year

my first real intro to grails a million years ago was at a NFJS conference where some well-known grails dude who did it full time and had written a book or two on grails failed to get a hello world example app working for half of his talk/demo.

in a sense that was successful cuz I never fell into the trap of trying to use it (I have fixed minor bugs in existing grails poo poo)

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

gonadic io posted:

plus just in terms of laziness of programming, gc has very little advantage over rc. sure rc might leak memory if you have cycles, and has a possible bigger runtime cost (although it's more predictable).

good point.

it's hard to imagine making RC any easier, but you could definitely make dealing with interior mutability and synchronization within an RC a lot easier. essentially thinking monad transformers.

you could maybe implement an enum that could opaquely be one of an (A)Rc<(Mutex|RefCell|etc)<T>> but expose essentially the same semantics as an owned T.

DONT THREAD ON ME fucked around with this message at 01:22 on Feb 24, 2019

luchadornado
Oct 7, 2004

A boombox is not a toy!

DONT THREAD ON ME posted:

i like your style. there seem to be a handful of like-minded yospos rust programmers we should all make something.

let's build the rust gc.

https://github.com/withoutboats/shifgrethor

quote:

In brief, a precise tracing garbage collector like shifgrethor is designed for works like this:

All of the references from the unmanaged portion of memory (stack and heap, in our context) into the managed portion of memory are tracked. These are called "roots."
From those roots, the collector "traces" through the graph of objects to find all of the objects that can still be accessed from those roots (and therefore, the objects which are still "alive.")

luchadornado fucked around with this message at 01:21 on Feb 24, 2019

gonadic io
Feb 16, 2011

>>=

also https://github.com/Manishearth/rust-gc

Adbot
ADBOT LOVES YOU

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder
shifgrethor is really cool

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