/dpt/ - Daily Programming Thread

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

Other urls found in this thread:

love2d.org/
twitter.com/NSFWRedditImage

AVL-based memory allocator using only standard C

I'm going to try write an IRC bot in Ruby.

Thanks for anime picture.

so how the fuck do I pass a lmbda to the constructor?

auto foo = [](){//do stuff};

FooBar f* = new FooBar(foo);

and then in the class set the expression as a local variable(?) (function pointer?). how do I do that?

It gets promoted to function pointer anyways but it's not worth the mess. Use std::function, it's what it was designed for.

>What are you working on, Sup Forums?
Have signed up on codewars.com, i am now ready to engage fights in the kumite. Anyone want to fight me? (beginners only)

Thank you for using an anime image.

Printf debugging with no I/O.

#include
#include

class LambdaAcceptor
{
public:
LambdaAcceptor(std::function lambda):
lambda(lambda)
{ }
void invokeLambda()
{
lambda();
}
private:
std::function lambda;
};

int main(int argc, char **argv)
{
auto lambda = [](){ std::cout

I'm fascinated by this code.
#include

class HelloInterface
{
public:
virtual void sayHello() = 0;
};

int main(int argc, char **argv)
{
class : HelloInterface
{
public:
void sayHello() override
{
std::cout

>anonymous class
Doesn't mean what you think. It's clearly a named class, you just didn't bind the type to a symbol.

>It's clearly a named class
What's its name?

>t's clearly a named class
what's its name then?

Whatever gets produced in the object code

Is intellisense in vs 2017 completely broken for anyone else?

That's for the compiler to worry about, that's not part of the code I wrote.
But regardless, it doesn't answer my question.

nice thanks. that works.

if you mean with broken "total heap of horseshit" then yes.

Not for me, it's working fine.

What are you expecting to get with this question? You haven't specified anything.

in the object code? what the fuck are you talking about? we, the programmers, are not reading the object code, we are reading the c++ code where that class has no name.

How do I fight you user? Do I write some obfuscated code and then win?

It's slow as fuck. It stops working outright sometimes.

Works On My Machineā„¢

I don't want to fight anymore but thank you anyway.

cute
CUTE!

>tfw when you will never solder circuits with cute tomboy girl

>Can destructure tuples when using "let"
>Can't do it anywhere else
Holy shit how can Rust be so annoying.

that's surprising because communist really excell in destroying

Stop shitposting you faggot.

just shaved off my literal neckbeard

i am a cs grad student, expert c programmer and haskell enthusiast

what happens to my programming ability now?

Now shave the rest of your body and put on your programming socks

t-that's kind of gay

>shave the rest of your body

nu-male, pls go

Hello, plebbit!

>he doesn't know the meme

there is literally nothing wrong with having a feminine penis and dressing like a qt schoolgirl

* The 2*sizeof(size_t) alignment here is borrowed from GNU libc, so it should
* be good most everywhere. It is more conservative than is needed on some
* 64-bit platforms, but ia64 does require a 16-byte alignment. The SIMD
* extensions for x86 and ppc32 would want a larger alignment than this, but
* we don't need to do better than malloc.

It's this kind of shit webdev mentality "we don't need to do better" why we can never have efficient software.

>not maximizing your programming ability
Get a load of this faggot

Meant for

>complete a simple java project for a client
>sudden urge to eat some curry
hmm

k tard

Garbage collection is a crutch for bad programmers.

use ed

programming languages are a crutch for bad programmers

What happened to the torrent for programming books?

Arya Stark.

obsolete

>Unity is bloat shit
>Godot gives me undefined behaviour that can't fix it
>Libgdx is java
>The other engines are even worse
Welp, time to kill myself and use SDL.

Manual memory handling is not necessary for most programs.

I bet you think manual transmissions are an acceptable safety risk and shouldn't be banned, too.

What a surprise, it's the shart-in-marts dragging standards down.

I'm German, idiot.

jmonkey is java but kind of comfy.
You could go with Urho3D or Gameplay3D.

ue4

If you thinkg manual memory management proves your "smartness" then I feel so sad for you, brainlet

>recomending fucking bloat and literal worse engines than unity

She is like 9 you fucking pedo.

NVM found my old magnet link. Unsurprising lack of R books, which I need because statistician.

make your fucking own you lazy babby ass

then write your own, you derp. you call everything bloat dont seem to have the first clue about anything.

How can you suggest a non-free engine? Fuck off.

Fun C++ fact. Passing a lambda to std::sort can give a 7x performance improvement in some cases over giving it a function pointer.

If you want fast C++ code, use lambdas and templates extensively. Don't write C with classes. Don't write Java without GC. Use the generic & functional zero cose abstractions that C++ offers.

IOQUAKE3 YOU FOOL

>you need UE4 and unity to make a mario clone
>"modern programers"

Any retard can scope his variables, it's not even hard. That's why it's so sad.

>I need an engine for a mario clone
indeed kek

I dont really care about stallman cucks like yourself

Doesn't D have pretty strong template functionality? It's the only reason I can think to use it desu

>stallman cucks like yourself
>he is the one who gets cucked by using non-free software
Sup Forums is not for you, fuck off back to be or something

templates are shit
come at me

>Arya Stark.
There is a book on D's templates. I think it's pretty cool

>He lives in a world where he can't trust other people
Poor you.

Your lack of python code does disturbs me

you are the one who promotes that everyone can do whatever the fuck they want with your software. you are too weak to defend your property and let niggers fuck it in front of you. the pure essence of cucking

wtf is govnocode

Shitcode

>he trusts people who refuse to show the code
lol

Also, foss is not only about showing code, there are many other freedoms as well.

Why are you still here?

I don't fight retards.

>so how the fuck do I pass a lmbda to the constructor?
class MyClass {
public:
template
MyClass(Lambda l) {
// Implementation
}
};
...
MyClass my_instance([](){});

but it's already python

Go promote your communism somewhere else please.

...

dont worry, I will be here forever. and so will you

The fact that you do not belong here will never change.

well that's too bad for you, isn't it

Exactly

>Not using single uppercase letters as type parameters

>not using single lowercase letters as parameters

we haskell now

what is this from

love2d.org/

But that would be less informative.
What happens if I say my template function accepts a T and someone tries to put something in there that could possibly be a T but they aren't sure because T isn't actually a type outside this context and then it turns out the thing they passed wasn't a T and there's nothing about the name T that should have told them it wouldn't be a T?

Sure goyim, you trust us, right?

wiresharks memory allocator.

Templates are shit compared to what they could be, but they are significantly less shit than not having any equivalent functionality at all.

I am a Jew and I look kind of like this except I don't look like I'm rubbing my hands together and scheming and my nose is big but not quite as big as the nose in that picture
Should I be offended?

you cant trick us

void* is about as type safe as templates pre-instantiation

I believe your impression on template is inflenced by C++ templates. FYI, you should not set C++ as a standard since it's generally mediocre at what it does (or tries to achieve)

>I am a *ew

Please explain

That's very rude