/dpt/ - Daily Programming Thread

Love me some pain in the arse edition
Previous

Attached: 1532512308773.jpg (1700x2470, 1.67M)

Other urls found in this thread:

eprints.lancs.ac.uk/86933/1/McNeil_suicide_in_trans_populations_for_pure.pdf
godbolt.org/g/1aByFs
youtube.com/watch?v=PNRju6_yn3o
twitter.com/SFWRedditVideos

Post your shaved legs, OP.

are there people in /dpt/ that actually do this

Attached: tumblr_pa9xtyldjb1vtmi9zo1_1280.png (1066x1920, 1.29M)

I've been lurking Jow Forums since 2007, and yes, there were a tripfag that shaved his legs and started wearing programming socks. It is a reason why it became a meme.

ok, am relatively new to Jow Forums (been here a few months, used to go on /mu/ a lot) and apparently I'm still catching up, thanks

Attached: 1462128560034.png (1052x1342, 769K)

you're too new to appropiate pictures like that
just a heads up

fuck off

Attached: 1494615907561.png (500x504, 327K)

>that 18 year old boomer who thinks he has some kind of authority because he wasted a lot of time on chinese cartoon website

Attached: boomer.jpg (250x229, 8K)

>getting upset by being called a newfag
Welcome to 4chins

is anyone else /embedded/ here? I feel like I'm the only one around here who does embedded systems stuff, and it's weird because I feel like it's one of the more accessible fields involving programming.

ty for defending me, user

Attached: 1492867871745.jpg (400x579, 72K)

you're too new to call other users newfag, newfag

Attached: 1246537762955.jpg (1573x1600, 456K)

>I feel like it's one of the more accessible fields involving programming
explain

...

>is anyone else /embedded/ here?
Yes.

>I feel like I'm the only one around here who does embedded systems stuff, and it's weird
Most people don't like to do embedded.

>TIME FOR Jow Forums!
what the fucking fuck is Jow Forums
i know only Jow Forums

I don't do because I don't have the equipment and no idea of a cool/"useful" project withit

Arduino.
that's my entire explanation.
I learned the basics of programming with Arduino. I grew up on that shit, back before the Uno had even become a thing. The community around it is huge and very supportive, the libraries are simple and intuitive, and amount of investment into various arduino projects/kits/etc is massive.

Arduino is the perfect foundation for getting into more advanced embedded stuff, and there's plenty of guides out there for getting into more bare-metal programming that assume a foundation in Arduino.

While I agree that Arduino makes embedded accessible, I disagree that it is a springboard into "advanced embedded stuff".

>Most people don't like to do embedded
oh :(

I mean, why would they? It takes a special kind of autism to feel accomplished by making a fucking LED flash three times after spending a day, when other people can create beautiful websites in a matter of hours by using powerful frameworks.

Most people don't like to spend money on shit that won't bring any money back (without a diploma) and nobody else besides themselves will give more than two shits about it.

I'm in the special hell of trying to learn execution semantics and assembly syntax for a processor I've never worked with before and debugging a few thousands lines of firmware code by reading memory dumps in HEX files a week before the product that uses it is supposed to launch
I deserve this

>ty for defending me, user
I wasn't, I was attacking the other guy

>literally the current year
>he hasn't taken the pascal pill yet

Attached: based.jpg (815x863, 278K)

>What are you working on Jow Forums?
I am working on my clock. Still not perfect, but it works.

PS: That should be a triangle and afterwards a hexagon, but because 2 of 3 wheel encoders are ded it's not really accurate

Attached: clock.webm (1280x720, 2.17M)

slav detected

Any good talks or papers

Nim is the superior Pascal

On what?

No clue, just looking for something to read while updating. Anything low-level would be nice

>Anything low-level would be nice
I would link you my paper, but it's not published until 18th August.

eprints.lancs.ac.uk/86933/1/McNeil_suicide_in_trans_populations_for_pure.pdf

Pretty low if you ask me

Nim has some good points but its function ("proc") declaration syntax makes me so irrationally angry that there's no way I'll ever use it

no lol

sure is

Attached: Screenshot from 2018-07-25 16-53-03.png (721x431, 43K)

If windows is the most popular os, why do the programming tools generally suck so hard on windows?

because it's for nerds. wtf. Do you think everyone is a programmer? no lol

Thoughts on abusing ranged for for automatic checking + extracting of std::optional value?
godbolt.org/g/1aByFs
Seems identical in codegen.

Ideally the Value hack would be built into my Optional type.

youtube.com/watch?v=PNRju6_yn3o

Where do you guys market your programming services online?

Attached: ancient_monument.jpg (1024x663, 185K)

Why do you think you deserve a serious response after replying to everyone

I don't
people come to me because I'm so good

The following info may actually shock you: I don't have a job

why don't you simply do if (auto &x = *opt; opt)

>Where do you guys market your programming services online?
I don't, I just post code on github.

>he hasn't heard of Anonymous
not gonna make it

I know it's only a reference, but, are you sure it isn't UB?
And what if I need to take it by value?

You're right, it is UB.

Here's an alternative solution, then.
template
void if_value(std::optional &opt, F fn)
{
if (opt)
fn(*opt);
}

/* ... */

if_value(opt, [](auto &val) { ... });

I've of course thought of that one, but the problem with that one is that I can't return from the function, because it'll just return from the lambda instead.

>going through this much of a cluster fuck to check if a pointer is null
Jesus fucking Christ, have you guys ever heard of overengineering.

It's not a pointer, it's an std::optional

The point still stands.

He's using that to avoid checking for nullptr.

Having a single exit point from each function is a good thing.

What is wrong with
int tmp;
if (some_func(&tmp)) {
/* Wow its something, use it! */
} else {
/* Wow its literally nothing, do something else */
}

Everything, when you need to pass a fucking callback in order to extract the value.

Then just make the callback an argument to the function?

How do I become productive?
I have backlog of programming learning and generally stuff to learn (software and side classes unrelated to computers but all I do is having depression or doing stuff that's vaguely related).

My desktop is littered with shortcuts to materials and books I should look into and the same about my desk, being a mess full of stacks of papers

Attached: indianstreetfood24.jpg (2000x1500, 2.86M)

he doesn't know that he can pass functions as arguments

It's just an attempt to hide uglyness
Imagine working with a std::optional

It's neither a good thing nor a bad thing. It is unnecessarily restricting though.

Disgusting temporary, passing output as input also requiring it to not be const. Scope larger than it should be.

Why don't you implement an OptionalBuilderFactory and a CallbackFacadeInjector while you're at it, and make your solution even more generic?

That's not something you can learn. You're either lucky and you're born with it, or you're genuinely fucked.

Just wait for C++34 to implement call/cc then.

You mean OptionalBuilderBeanFactory and CallbackBeanFacadeInjectorBean?

Are you seriously advocating java enterprise memes?

I became lazy around year ago when I burned out during the final year of university. Before that I'd spend hours studying. Now I'm just sleepy and uninterested in anything that isn't immediate danger like an exam within a week or two, for example.

I'm seriously making fun of overengineering. Passing in a callback to extract a value from an optional is some serious Pajeet level programming.

Kek. You got me user

std::optional is what is overengineered pajeet shit

For checking a null pointer, yes. But generally, no.

Post your alternative.

>He raises the requirement to C++17 because he couldn't just use a boolean

Using callbacks to switch behavior over the different states of a Maybe type is perfectly normal if your language lacks built in pattern matching.

>What are non trivial types

Describe a real-world scenario where you would actually use it and I will provide a better alternative

std::optional make_some_resource()

>tfw no klossy to kode with

Attached: 098d7e63cba57865855dbdbd17077d9b.jpg (2048x1105, 134K)

>Using callbacks to switch behavior over the different states of a Maybe type is perfectly normal if your language lacks built in pattern matching.
I think that maybe (pun intended) your definition of "perfectly normal" is very different than mine.

Code should be first and foremost readable and correct. Pattern matching is readable and easy to prove that it is correct. Boilerplating some wild implementation i leu of it may be (pun intended) correct, but it's not so easy to read and not so easy to prove.

typedef struct OpaqueObj OpaqueObj;
OpaqueObj *opaqueObjNew(void);
OpaqueObj *obj = opaqueObjNew();

>unnecessary heap allocations
gross

Just another example of C code deceptively looking fast but actually unnecessarily inefficient as shit to get around their shitty language.

>the ABSOLUTE state of ceniles

Well that's not a solution I use.
I use this:

typedef struct {
/// ...
} Obj;

Obj obj;
objNew(&obj);


objNew takes a pointer to Obj, if it's NULL, then a new object is allocated on the heap, otherwise it's assumed the pointer points to an unitialized Obj on the stack.
In both cases, if the function fails, NULL is returned, and on success non-NULL is returned.

see

>NonTrivial

Which one should I pick for C++ 14

Attached: 6dv39fbyjfme.jpg (225x225, 19K)

>Overengineered

>Which one should I pick for C++ 14
The one that matches your socks, duh.

Why would you wear socks on your hands?

>Anything I don't understand is overengineered

Nontrivial types don't need to exist. ctors/dtors are bad juju.

Code has to be simple to understand, because it's twice as hard to debug it.
If you write code as cleverly as you can, you are, by definition, incapable of debugging it.

>no sheer
what kind of faggot ass rubbish is this?

Attached: 34834781348.jpg (300x520, 112K)

>Simple for compiler to compile = simple for human to understand

Is it not hilarious that the actual assembly is super simple, yet the source code is a complete clusterfuck?

No doubt that Unix dinosaurs and the people responsible for the clusterfuck that is C thought that debugging code was hard. The point of writing correct code is that you don't have to debug it.

std::optional is literally one of the simplest new features you fucking mongoloid

Reduces the drag over the table and enhances blood circulation in the hands, which increases the typing speed.

You are the faggot. Socks must be long on Jow Forums.

>not wearing kneesocks or thighhighs
What kind of faggot are you?