News for hackers. Stuff that matters.
Re:C and C++ Prioritize Performance over Correctness by packetlost on Friday August 18, 2023 @04:41PM (#37181819)
Idk what you're on about, I mmaped a `/dev/uio` from Python this morning. Yeah, I had to add it in a .dts file and rebuild my image, but even slow as shit high level languages like Python let you bang on registers if you really want to.
Re:C and C++ Prioritize Performance over Correctness by notacoward on Friday August 18, 2023 @05:55PM (#37182680)
That worked because you were on an OS that supported it, using a device with simple enough behavior that things like timing or extra/elided writes didn't matter. It's great when that works, but there are very many environments and devices for which that option won't exist.
Re:C and C++ Prioritize Performance over Correctness by packetlost on Friday August 18, 2023 @07:01PM (#37183234)
> That worked because you were on an OS that supported it

I mean... yeah? I'd be surprised if most operating systems didn't have a facility for directly accessing memory mapped devices in some capacity. Even Windows does I think. Have any examples of an OS that doesn't support banging directly on memory?

> using a device with simple enough behavior that things like timing or extra/elided writes didn't matter

Yeah, but that's less of a function of the language like GP was referring to and more a property of using a non-RTOS that doesn't play nice with timing sensitive things from user-space. The language itself is not really the issue there, which was my point.

Re:C and C++ Prioritize Performance over Correctness by memefrog on Friday August 18, 2023 @08:01PM (#37183827)
>I mmaped a `/dev/uio` from Python this morning.

You might want to go and have a look at the implementation of 'mmap' in CPython. Here's a clue: it's in the name 'CPython'.

Re:C and C++ Prioritize Performance over Correctness by kaba0 on Saturday August 19, 2023 @02:04AM (#37186006)
As it is for an OS written in C, sure it does have some helper C wrappers.

It is still “syscall”s at the end of the day, and many programming languages can output assembly just fine.

Re:C and C++ Prioritize Performance over Correctness by packetlost on Saturday August 19, 2023 @12:10PM (#37190206)
There's nothing special about C that makes it possible to use mmap. Just because CPython happens to be implemented in C doesn't mean anything in this context. I could do the same thing in Go or Hare, neither of which have any C in them and be able to do the same thing.