/dpt/ - Daily Programming Thread

Old thread: What are you working on, Jow Forums?

Attached: 1562871331943.jpg (700x1000, 561K)

Other urls found in this thread:

g.sicp.me/books/
libgen.is/
github.com/nothings/stb/blob/master/stb_rect_pack.h
benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/sbcl-gpp.html
bellard.org/quickjs/
careers.kaspersky.com/job/Developer-на-Rust-(QA-Team,-KasperskyOS)/561880800/?locale=en_EU
twitter.com/NSFWRedditGif

Daily offer to prove that C++ is actually no really guys I'm serious capable of performing outstanding memory allocation optimisations:

>Then why don't you go ahead and run some C++ program with an overloaded malloc implementation that counts how many 64-Bytes-or-less allocations have been performed? And with a corresponding free overload you can see how long they survived. I also don't care about your synthetic benchmarks for a simple program, all right? I want real-world applications.

, and that's why it's better than C.
>in4 cnile
>still no data
>still winning

¯\_(ツ)_/¯

Going through Automate the Boring stuff right now. What job can I land if I become semi-proficient at Python?

nth for writing disgusting code because you're too much of a brainlet to think of a proper solution

i know that feel, user

Attached: 0.png (112x112, 29K)

overloading malloc is going to ruin optimisations

Working on libqmi. Implementing firmware selection on Telit modems so I can switch this America-only modem to work in the rest of the world.

Attached: B4ED45FD-0DE7-4DAA-9111-6D7A3BBCA3C3.jpg (1296x968, 1.05M)

How, if the symbol is preloaded at runtime?

I sure hope you are coding your next project on a flavor of Lisp, user.

not a sepplesfag but look, if you have something simple like printing every malloc, that means the compiler can't do multiple mallocs at once without changing the behaviour of the program

What was that site with the free books again?

>that means the compiler can't do multiple mallocs at once
>the compiler
>the compiler doesn't run at runtime

You're aware of that?

and it can't be as aggressive or effective with a user defined malloc as it can with standard malloc
bible dot com

>muh malloc
The difference in speed is unnoticable, but your program will be more likely to leak or crash

g.sicp.me/books/

t. never wrote software anyone cares about

you're either stupid, an ESL, or arguing in bad faith
>code says allocate a byte 8 times
>allocate 8 bytes at once instead
again this is a dumb example, i'm not a sepplesfag

>what is LD_PRELOAD
>what is symbol injectio
>what does it have to do with compiler optimisations?

The very purpose of overloading malloc/free is so that you see the "optimisations" the oh so powerful compiler unleashes upon the runtime environment. If it can do that properly there's not going to be that many 64-Bytes-or-less allocations.

>mad for being wrong
>too incompetent to proof he's right
>ad hominem attacks

Predictable response. I'm gonna go get a shower, because I need to get ready for work - developing software that people care very much about running properly.

I meant the russian one, lib.io or something

>The very purpose of overloading malloc/free is so that you see the "optimisations"
i'm telling you that overloading malloc can make some of those optimisations more difficult for the compiler

libgen.is/

Thanks man

And I'm telling you that the fucking compiler doesn't have ANYTHING TO DO with symbol overloading at runtime, and if you had any idea how program execution worked you wouldn't keep spouting that nonsence. Google "LD_PRELOAD" and prove me wrong, I'm gonna get me that shower.

Dude this looks awesome.
Guess I'm downloading this.

don't hoard a bunch of books on wildly varying topics, you'll never open any of them.
Pick one field/topic and start a book at a time.

I count on basically downloading this and referring to this list whenever I need to learn something. That's a good plan right?

Most books are outdated though, that link is as old as Jow Forums

I guess I'll only refer to old material for mature stuff and research a bit more when it comes to newer stuff then. Some stuff really doesnt change imo

you mean if it's dynamically linked?

Someone should update this list with newer books then.

You can't just update a torrent

Make new torrents every months with an updated list.

>you mean if it's dynamically linked?
Dynamically linked, yes. Like real-world applications. Literally the second post in this thread.

The point is this: the new operator is *likely* to just call malloc itself (and if not, then I'm already wrong and C++ managed to get some actually proper fucking management in the meantime; now they only need to disclose the pools via public interface or whatever). In any case: whatever the compiler is going to optimise - whatever is going to be written in the binary - still has functions that are resolved dynamically.

I want you to see the result of that optimisation, not whatever the compiler churns out because it cannot apply those optimisations. Maybe then people will release that those "optimisations" are not nearly as impressive as a properly coded C program.

>release
Realise. In my defence I just woke up.

Why do programming books feel much more comfy to go through than random tutorials on the internet?

Attached: 1562797697966.png (1055x945, 663K)

because books are the best
the only people who dislike books are absolute brainlets who read slower than people speak

I thought it was a meme, but I'm starting to think that LISP might actually be the most powerful programming language.

They say it for a reason.

Books are often more thorough. I don't really mind either way, what makes me uncomfy is when a book/other resources is trying to teach me something without giving me exercises.
Some people haven't understood that working by yourself is the most important step in learning, and a good teacher helps you work a lot on your own.

>dude like i can make my own syntax!
zzzzzzz

And what is that reason?

It's close to true, if not outright true. Once you learn Lisp you will see what is missing in most other languages.

and that is?

LISP stands for Language is Incredible Super Power

read/eval/print (many langs claim to have this but get it wrong), good metaprogramming primitives with homoiconicity to make it smooth and straightforward

book:
>Hi, I'm Dennis Ritchie and I'm going to teach you about the programming language I invented.
video:
>hello sirs it is rajeesh and today i will show net beans tutorial for windows 7

Can anyone explain to a brainlet like me how to use stb_rect_pack?
I'm trying to get it to work but I can't figure out how I'm supposed to initialize this stuff.
Here is a link to the library github.com/nothings/stb/blob/master/stb_rect_pack.h

>5 times slower than C++
No thanks.
benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/sbcl-gpp.html

Is this why I loved David Touretzky's book about Common Lisp that much? That book was so thorough, yet simple, and proposed exercises. It felt like I was getting stuff. Maybe I should read books more.

What does this & I highlighted mean for this overloaded operator?

Attached: Capture.png (641x150, 6K)

no one knows really, it just works so we do it

oh no mah nanoseconds

It returns a reference. You do this a lot with streams so you can chain operators, you can also do it with regular methods e.g. when doing builders.

none of those things are special.

That's less than I expected. 1/5 the speed of C++ is fast enough for most applications.
This doesn't even take into consideration the difference in simplicity in implementing better algorithms or keeping track of threads.

In the end it's hard for any language to beat super trimmed C++, but my hunch is that given equal and limited development time many applications can be made to perform better in something like LISP. I have nothing to back up this statement with though.

(ostream&) operator

these things are done best in lisp. as I said most languages botch the idea of read/eval/print, and most languages don't have simple enough syntax to make metaprogramming comfortable.

Why are they best in Lisp?
Because of easy AST access?
You seem like someone who's just started Lisp and in the honeymoon phase, but doesn't actually understand the language enough to elaborate/defend on the specifics of your very bold claim.

you could ask for suggestions

because printed expressions are also readable expressions, and because evalable expressions are also evalable.

that's not exclusive to Lisp.

I don't presume it to be, but I don't know many other languages where it is true, and I find it hard to believe that such a thing would be comfortable to use since lisp's AST simplicity is such a boon

If you successfully badger someone who needs a lot of badgering to adopt your language, does it improve your community?

Attached: splash.png (450x338, 197K)

>Ya, I always compile with -Wall -Werror -fsanitize=memory

Attached: normal_pramga_directives.png (509x693, 40K)

If your community is ill

Books have editors who have learned, either by experience or education, how to recognize what people will find accessible. They will demand an author write and rewrite and rewrite a section until it's just right.

bellard.org/quickjs/
The mad lad does it again.

Why does the C++ standard forbid type punning via union? It's legal in C and already allowed on every major C++ compiler anyway.

C++ values have to be constructed to be valid.

But why? Explain a situation where type punning via a union would make some important optimization impossible.

C++ has some strange opinions on what it means for an object to exist or be destroyed. It's why naive use of malloc is undefined behaviour, for example.

Use appropriately aligned arrays of unsigned char instead.

It's not about optimization, it's about values not being initialized properly and thus having an invalid state.

What languages do you think will be popular in 10 years from now surpassing Java, C, Python and JavaScript?

Kotlin, Rust, Python, JavaScript.

Python and JavaScript are already the most widely used.

Rust is already dead.

Kotlin could go either way. Java programmers might actually take it up, or it will meet the fate of all languages that try to be "Java but better".

> Rust is already dead.
Except Facebook has just launched its cryptocurrency written in Rust, while the language took the top position in 5 out of 6 techempowered benchmarks.

>shiny new startup projects mean industry wide adoption
No

But like said, it's fine to cast an object to/from a byte array. It's also fine to memcpy between POD objects of different types. I don't see any good reason why those things shouldn't violate what you're saying but type punning should.

Because there could be invariants about the internal state of an object which you can't guarantee with a union.

There could be invariants about the internal state of an object which would get BTFO by memcpying some random bytes onto it as well but that's allowed. It's up to the programmer to avoid doing such stupid things.

C will stay on the trend of decline but still alive.
c++ will still be standard but also stay with c on the downward trend.
Java will go the way of C.
Rust will be the "popular" language that's forever stuck in the grassroots phase. And I also see a splinter lang happening from someone/people in the Rust community.
JS will go the way of C as newer langs and WASM trend higher even.
Haskell and FP will be much more popular as well.

I don't think it's allowed to memcpy into non-POD object.

>Rust is already dead.
?

The C++ standard ensures that when an object is built the constructor is run and when an object is destroyed the destructor is run. Anything else is undefined behaviour, and any other invariants don't matter.

>Haskell will be more popular
Opinion discarded.

> Haskell and FP will be much more popular as well.
Oh boy, I've been hearing this for 15 years now, I even learned myself a real-world haskell for great good back in 2008. I still write in C++ for money, waiting to capitalize on my knowledge of monad transformers any day now. Meanwhile, I'm getting an offer for a Rust position every couple of months just because I have some on my github.

I'm not talking about non-POD objects, I'm talking about POD objects which the standard already considers safe to memcpy.

>getting an offer for a Rust position every couple of months
where do you live?

this, haskell already is the most popular

Attached: 1552822104960.png (550x783, 401K)

Wow, that is a SLUTTY skirt!

Rust is all marketing. They claim that Rust has both safety and performance, and that it has basically solved the most difficult problem in programming. This is hogwash of course.

If they were more honest I might give it a try but right now it's another crappy language that doesn't do anything better than what's already out there.

Attached: file.png (1207x826, 57K)

in his mother's basement.

Attached: 1547388956269.png (1280x720, 1.17M)

I dunno why you're fixated on memcpy. It's irrelevant. The standard is clear, objects can only be accessed if they are initialized. That happens in declarations which aren't unions or with new expressions. That's all there is to it.

Russia, the latest one was from Kaspersky, they want to use Rust (specifically with tokio) to write an elaborate QA framework for their OS, which is a kinda weird choice of language desu: careers.kaspersky.com/job/Developer-на-Rust-(QA-Team,-KasperskyOS)/561880800/?locale=en_EU . Maybe they just want a test project to evaluate the langue.

it's funny because I never heard all of these bold claims from rust (mostly because I just don't care about the language, I admit) except on here by all our woke anons () who just can't shut up.
It's almost as if they were paid to shill false outrage on falsehoods.

Literally watch any talk on Rust and they spend half the time talking about how great Rust is without showing why.

If I have a byte array and cast it to a POD struct Foo*, when was my Foo initialized? How is this different than having a union containing a Foo and a same sized POD Bar, assigning to the Bar, and reading from the Foo?

>fags telling other fags how much they like to be fags
shocking

>If I have a byte array and cast it to a POD struct Foo*, when was my Foo initialized?
I believe that's still undefined behaviour, even though it'll work on most any compiler. You need to create an object with a placement new expression, even if it's a NOP.

Literally watch any talk on C... Oh, right, there are no talks on C, no one cares about it besides the suckless faggots.