/dpt/ - Daily Programming Thread

What are you working on, Sup Forums?

Previous thread:

Other urls found in this thread:

github.com/DevmanAuthor/Hinom_sdl
godbolt.org/g/gYuDnf
nibblestew.blogspot.com.au/2017/12/comparing-c-c-and-d-performance-with.html
doc.rust-lang.org/src/core/iter/sources.rs.html#24-26
doc.rust-lang.org/src/core/iter/sources.rs.html#50
twitter.com/NSFWRedditImage

Take your reddit meme and go back

Still better than anime trap shit.

First for sepples is the bestest

I'm working on a remake of this(pic related) exasperating piece of trash in c & sdl.
Feel free(PLEASE) to see & criticise my code:
github.com/DevmanAuthor/Hinom_sdl

Who knew that programming a simple game could be so insanely difficult and time-consuming with crap I'm barely familiar programming with like "Renderers" and "Textures vs Surfaces". It's been months and I've like made 7 different sources & headers with a lot of code and barely jack to show for all my work. WHAT AM I DOING WRONG??!!!

The longer I work with the code at my job, the more and more a hate it.
If I had the time, I would rewrite this shit from scratch.

Current state of windows 10:
"Come on update now, you don't wanna get some unwanted security breach right?"

after update:
"I don't care about your configuration, and all of the uninstalled unwanted bloatware. Let me reinstall all of that according to the great lord Microsoft. Also, all of the adware, and the data collector store has been reinstalled."

>If I had the time, I would rewrite this shit from scratch.
I imagine most people would.

>Actually using windows

...

Kill yourself, you degenerate fuck.

Is having windows inside virtual machine just for /vg/ illegal?

What is with the underscores in your commit messages? Are you a brainlet? Just use a string, or better yet, actually use the text editor to write a helpful commit message so that you know why you made a change so that when you go back in time to figure out why something exists, you can easily find out why with git blame. For commit messages, remember:
>50 characters on the first line, no periods
>blank line
>72 characters per line afterwards for deeper explanation

>for /vg/
I guess not

Are you completely rebuilding or refactoring? The utils.h/c is giving me diarrhea.

>underscores in my commits
I made function in bash to shoot my commits fast without typing git commit -m "commit whatever", but unfortunately it doesn't let me add spaces if I do that

Wrap your arguments in "", idiot.

...

Why do you have to be autistic? Just have better commit messages.

...

Can someone explain this picture to a foreign user?

The first says there is a single bug.
The second says there are multiple bugs.

That's it from me. Goodnight, fa/g/s.

Assuming what I think you're saying, I completely rebuild the entire thing. Just look at build.sh

found the bug : there is only 1 bug, and the person in action found it.

found a bug : there is unknown number of bug, and the person in action found one of them

its easier.
>typing minimal on the command like
gcm "commit" saves more itty bitty fractions of my time instead of git commit -m "commit"

>he doesn't use VSC where you just have to input the commit message, then send and push it taking a total of three binds

Tell me your programming secrets, /dpt/

I'll start: despite working for a Microsoft centric corp as a .NET developer, I prefer Java and the JVM to C#. The core Java language is much simpler and enjoyable, it does not have feature bloat, the ecosystem is much bigger and the tools are better (IntelliJ vs Visual Studio). Java is like C while C# is like C++: bloat and terrible design decisions, just because they want to add new things every year to sell a new version of Visual Studio.

instead of just literally explaining the words like an autist, here you go:

It's a joke implying that a junior dev is naive and upon seeing a problem in some program, he goes "I found the only bug, just have to fix it and everything works perfectly". The senior dev, relying on experience, doesn't make such an assumption and (realistically) expects more bugs to pop up later

fuck off

Can't imagine my brain on enterprise POO.
Glad i never fell for the uni and enterprise programmer traps.

>Tell me your programming secrets, /dpt/

I never wear socks during programming

First one had assignment that he successfully completed
Second one is just dude on the job

So is your end goal is to try and create the worst opinion in the history of opinions?

JVM's great but ditch that archaic language. Use Scala or Kotlin and stop hating convenience.

>Use Scala or Kotlin
hed be trading one kind of shit for another.

>enterprise programming traps
But that's the best part of programming. Having real world problems, some of them involving money, into solutions and then into code.

>WHAT AM I DOING WRONG??!!!
Probably overthinking shit. Also, if I were you, I would just use Allegro 4 or something. It's old, but definitely much comfier than SDL.

Unironically this.
>Java is like C while C# is like C++: bloat and terrible design decisions, just because they want to add new things every year to sell a new version of Visual Studio.
This statement holds for shitlangs like Kotlin too.

Nah Java is pretty good, no need to waste time learning another language. Time that is better spent doing actual work.

I'm more intrested in languages than in the programs I could make in those languages - everything I needed to automate has already been done by somebody else.

You can always focus on making compilers and interpreters if you like languages.

>writes project in c -> super verobose
>has a script to write out his own commit messages

If you want, like text editor git commits you could probably save the raw text of the commit in a file and do a cat file redirect as you input commit message I've never tried though.

Even if all problems would be solved, we feel this doesn't solve the riddles of life.

We are going into the wall at high speed.

Unless you're lucky/invested enough to become a lead/manager. You'll constantly have to deal with sub-par commits and programmers. And you can't even choose a nice language to use, unless you're also lucky enough to be the CTO of a startup or something.

junior dev: posting memes like OP posted

is being called a 'dev' not degrading af?

Not that guy, but i'd love that, but i don't think there are many jobs for compiler writers, unfortunately.

Yeah, but when I come up with an idea I look it up and realize it's already been done in some language. I gave up when I learned about UFCS, before that I thought it was real fucking smart idea that nobody has thought of before.

>enterprise POO
top kek

a little uni is good tho, you learn basic shit that's very much needed either way

You need to study more languages then.

I've already tried like 20 languages.

afaik unis don't teach POO programming very well, you learn that while interning and shit

And all 20 of them didn't have UFCS?
Amazing.

>when I come up with an idea I look it up and realize it's already been done in some language
Doesn't really matter. Do you think something like C++ or Rust or D has an ounce of originality to it? If you want to create a programming language, just focus on filling some niche. This could be as simple as providing the correct combination of language features + some appropriate syntax sugar.

Is there some language that did the BC before Rust?

It turned out it was in D.

people who are willing to learn C++ really well can learn anything and not just programming related

they can become brain surgeons with less effort ffs

so why then learn C++ and not something really cool instead?

Rust, Nim, D all have it.
C++ is supposed to be getting a fucked up version of it.

What would you prefer as explicit kind notation?
T: [*, *] => *
or
T: [Type, Type] => Type?

Yeah, but I came up with the idea in 2013. Then I checked out D, that's where I learned the name for it from.

Are you against using C++?

>Is there some language that did the BC before Rust?
I don't know if any other language implements it exactly the same way as Rust, but restricting references to an object is not a new idea.

"Yeah, I do sepples" is the best pickup line ever. Always works.

Impl blocks are UFCS?

What's C++'s version going to look like?

No one cares about one great feature if the rest of the language is trash. This is the biggest issue in Rust with its BC. Don't focus on trying to make the next world-shifting language, just focus on refining all the shit into a saner, enjoyable language. This is what D is doing and why i love it. But we're shifting towards functional programming. So figure out how to speed up type-checking and use RC'ing or something, so we can have comfy functional systems langs.

>Are you against using C++?
Why the fuck would you suggest this productivity blackhole to someone who is already struggling to get anything done? His problem is not a language issue.

>functional systems langs
Good luck trying to reason about the performance implications and the code generated by a pile of functional abstractions. Exercise for the reader: implement this efficiently in C++: map(f1, filter(p1, map(f2, filter(p2, coll))));

I mean, C++ doesn't even have ranges, so UFCS is kinda pointless. Not because UFCS is bad, it's because C++ is not good enough for UFCS.

> Don't focus on trying to make the next world-shifting language, just focus on refining all the shit into a saner, enjoyable language. This is what D is doing and why i love it.
This is why D is dead tho, by being the arithmetic average of C++ and Java/C#, it offers no sensible benefits over either of these.
>Good luck trying to reason about the performance implications and the code generated by a pile of functional abstractions.
Not a problem in a decent language.
> Exercise for the reader: implement this efficiently in C++: map(f1, filter(p1, map(f2, filter(p2, coll))));
Rust is pretty good at it, it even vectorizes the code: godbolt.org/g/gYuDnf . I don't think it would be a problem for C++ compiler either.

git commit -m

I think you got the wrong post number, user. I wasn't talking about UFCS.

Also you could do this as well to not worry about strings.

git commit -m

>Rust is pretty good at it, it even vectorizes the code
Where's the guarantee that `map(f1, filter(p1, map(f2, filter(p2, coll))))` won't take four passes?

>Where's the guarantee
Where's the guarantee gcc's -O3 won't be identical to -O0? Do any optimizing compilers provide any hard guarantees?

>Where's the guarantee gcc's -O3 won't be identical to -O0? Do any optimizing compilers provide any hard guarantees?
That was exactly my point. Good luck coming up with functional abstractions with SEMANTICS that guarantee a reasonable level of efficiency. Praying that the optimizer will do the right thing =/= understanding the performance implications of the abstractions you're piling up on top of eachother.

Is there any way to group a method in C++?
for example I have this class
class foo{
std::vector data;
char check() {
if(score_a() > score_b()){
return 1;
}
return 0;
}
int score_a() {//calculate based on data}
int score_b() {//calculate based on data}
public:
void win(){
if(check()){
std::cout

When you're operating on iterators, then the operations are guaranteed to be lazy, so you can be sure that, for example, map doesn't return a whole new collection, but an iterator representing all elements of the underlying iterator applied to a function.

I use c with g++

Can anyone recommend a language to learn? I have a lot of free time and am looking to do something productive. Thanks.

Look everybody at the worst kind of retard there is

Learn Shen

C/C++ people are mentally ill in general

>When you're operating on iterators, then the operations are guaranteed to be lazy, so you can be sure that, for example, map doesn't return a whole new collection
`map` isn't the problem. The problems (for iterators, at least) crop up when some stage in your transformation is not one-to-tone. How does Rust solve that?

I don't use rust much, but i guess, that if your iterator has the interface of next: Option, then things like filter are not a problem either, since they can just skip some elements from underlying iterator until one satisfying the predicate is found or the end is reached. Things like flatmap might have to store some additional data if the function returns collections, but if it returns iterators too, then it shouldn't be too costy either.

Java

nibblestew.blogspot.com.au/2017/12/comparing-c-c-and-d-performance-with.html

How is it retarded? Gcc standards are compitable with g++. Compiling it this way ensures compatibility when compiling with both gcc and g++ (in case anyone or I would ever need to)

>he writes shitty C so he can compile it with sepples compiler

>shitty c because g++
elaborate? Does compiling c code with g++ eventually force me to reduce the quality of c code I write? Then welp I'll need to revert to an earlier commit then

>but i guess, that if your iterator has the interface of next: Option, then things like filter are not a problem either
Sure, if you specialize your interface specifically to get around this problem. Now imagine a transformation that may duplicate some items. How are you going to fix your interface now? Vec?

So it's even worse than I expected.

>C
>+1000 memory leaks
kek I guess the memes are true after all

>a transformation that may duplicate some items.
So flatmap (aka mapcat aka (a -> [b]) -> [a] - [b]).
It just has to next the underlying iterator, apply f to that element, store the result and keep yielding elements from that until it's exhausted, then repeat that for all elements from the iterator. It's mutable, sure, but you could just as well go next: Option

> Now imagine a transformation that may duplicate some items. How are you going to fix your interface now? Vec?
Iterators have states, so you can store the item in the state and return Some(item) two times, Repeat is the closest thing doc.rust-lang.org/src/core/iter/sources.rs.html#24-26 . Sure it could require some internal storage for non-trivial Iterator instances, but that would be more or less equivalent to doing the same task by hand.

Oh, and by returning an option i mean, that it returns some when there's at least one element left and none when the iterator is exhausted.

If the program is not meant to run for long time then it makes sense to not free the memory because operating system will claim it after the process is done.

Meanwhile, apparently Rust team uses emojis in doc comments: doc.rust-lang.org/src/core/iter/sources.rs.html#50 . The future is here, guys.

Laziness.

>Explicit de-allocation calls
>79

Their forum uses emoji too.